jetrix-cvs Mailing List for Jetrix TetriNET Server (Page 5)
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-11-16 21:25:03
|
Revision: 775 http://jetrix.svn.sourceforge.net/jetrix/?rev=775&view=rev Author: smanux Date: 2008-11-16 21:24:58 +0000 (Sun, 16 Nov 2008) Log Message: ----------- Added the tspec applet Modified Paths: -------------- monitor/trunk/src/main/webapp/server.jsp Added Paths: ----------- monitor/trunk/src/main/webapp/jetrix-0.3-SNAPSHOT.jar monitor/trunk/src/main/webapp/spec.jsp monitor/trunk/src/main/webapp/webspec-0.1-SNAPSHOT.jar Added: monitor/trunk/src/main/webapp/jetrix-0.3-SNAPSHOT.jar =================================================================== (Binary files differ) Property changes on: monitor/trunk/src/main/webapp/jetrix-0.3-SNAPSHOT.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: monitor/trunk/src/main/webapp/server.jsp =================================================================== --- monitor/trunk/src/main/webapp/server.jsp 2008-11-11 23:12:19 UTC (rev 774) +++ monitor/trunk/src/main/webapp/server.jsp 2008-11-16 21:24:58 UTC (rev 775) @@ -6,6 +6,7 @@ <%@ page import="net.jetrix.monitor.ServerInfo" %> <%@ page import="net.jetrix.monitor.dao.ServerInfoDao" %> <%@ page import="net.jetrix.monitor.StyleUtils" %> +<%@ page import="java.net.URLEncoder" %> <% WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); ServerInfoDao dao = (ServerInfoDao) context.getBean("serverInfoDao"); @@ -21,6 +22,7 @@ countryFlag = countryName; } + boolean viewable = server.isSpectate() && server.getSpectatorPassword() != null; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> @@ -155,6 +157,9 @@ <th>Description</th> <th>Players</th> <th>Status</th> +<% if (viewable) { %> + <th>Action</th> +<% } %> </tr> </thead> <tbody> @@ -164,6 +169,13 @@ <td><%= StyleUtils.toHTML(channel.getDescription()) %></td> <td><%= channel.getPlayernum() %> / <%= channel.getPlayermax() %></td> <td style="color: green; font-weight: bold"><%= channel.isPlaying() ? "INGAME" : "" %></td> +<% if (viewable) { %> + <td align="center"> +<% if (channel.getPlayernum() > 0) { %> + <a href="spec.jsp?id=<%= server.getId() %>&channel=<%= URLEncoder.encode(channel.getName()) %>">View</a> +<% } %> + </td> +<% } %> </tr> <% } %> </tbody> Added: monitor/trunk/src/main/webapp/spec.jsp =================================================================== --- monitor/trunk/src/main/webapp/spec.jsp (rev 0) +++ monitor/trunk/src/main/webapp/spec.jsp 2008-11-16 21:24:58 UTC (rev 775) @@ -0,0 +1,39 @@ +<%@ 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" %> +<%@ page import="net.jetrix.monitor.dao.ServerInfoDao" %> +<%@ page import="net.jetrix.monitor.ServerInfo" %> +<% + WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); + ServerInfoDao dao = (ServerInfoDao) context.getBean("serverInfoDao"); + + ServerInfo server = dao.getServer(Long.parseLong(request.getParameter("id"))); + + String channel = request.getParameter("channel"); +%> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>TetriNET Player - <%= channel %> on <%= server.getHostname() %></title> + <link rel="stylesheet" type="text/css" href="stylesheets/style.css"> + <link rel="Shorcut Icon" href="favicon.ico"> +</head> +<body> + +<h1>TetriNET Player - <%= channel %> on <%= server.getHostname() %></h1> + +<div align="center"> +<applet code="net.jetrix.spectator.SpectatorApplet" archive="webspec-0.1-SNAPSHOT.jar,jetrix-0.3-SNAPSHOT.jar" width="640" height="480"> + <param name="hostname" value="<%= server.getHostname() %>"> + <param name="password" value="<%= server.getSpectatorPassword() %>"> + <param name="menu" value="false"> + <param name="channel" value="#<%= channel %>"> +</applet> +</div> + +<a href="server.jsp?id=<%= server.getId() %>">Back to the server info</a> + +</body> +</html> Added: monitor/trunk/src/main/webapp/webspec-0.1-SNAPSHOT.jar =================================================================== (Binary files differ) Property changes on: monitor/trunk/src/main/webapp/webspec-0.1-SNAPSHOT.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-11-11 23:12:24
|
Revision: 774 http://jetrix.svn.sourceforge.net/jetrix/?rev=774&view=rev Author: smanux Date: 2008-11-11 23:12:19 +0000 (Tue, 11 Nov 2008) Log Message: ----------- Implementation of the database connection Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/pom.xml jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/ServerAction.java jetrix/trunk/src/admin/server.jsp jetrix/trunk/src/etc/tetrinet-server.dtd jetrix/trunk/src/java/net/jetrix/Server.java jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java Added Paths: ----------- jetrix/trunk/lib/commons-dbcp-1.2.2.jar jetrix/trunk/lib/commons-pool-1.4.jar jetrix/trunk/src/java/net/jetrix/DataSourceManager.java jetrix/trunk/src/java/net/jetrix/config/DataSourceConfig.java Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/build.xml 2008-11-11 23:12:19 UTC (rev 774) @@ -151,6 +151,8 @@ <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-digester"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-beanutils"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-lang-2.0-light"/></antcall> + <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-pool-1.4"/></antcall> + <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-dbcp-1.2.2"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="jetty"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="servlet-light"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="jasper-runtime"/></antcall> Added: jetrix/trunk/lib/commons-dbcp-1.2.2.jar =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/commons-dbcp-1.2.2.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: jetrix/trunk/lib/commons-pool-1.4.jar =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/commons-pool-1.4.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/pom.xml 2008-11-11 23:12:19 UTC (rev 774) @@ -117,6 +117,18 @@ </dependency> <dependency> + <groupId>commons-pool</groupId> + <artifactId>commons-pool</artifactId> + <version>1.4</version> + </dependency> + + <dependency> + <groupId>commons-dbcp</groupId> + <artifactId>commons-dbcp</artifactId> + <version>1.2.2</version> + </dependency> + + <dependency> <groupId>jetty</groupId> <artifactId>jetty</artifactId> <version>4.1-rc1</version> @@ -148,7 +160,7 @@ <directory>src/etc</directory> <targetPath>/</targetPath> <includes> - <include>*.xml</include> + <include>**/*.xml</include> <include>*.dtd</include> </includes> </testResource> Modified: jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/ServerAction.java =================================================================== --- jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/ServerAction.java 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/ServerAction.java 2008-11-11 23:12:19 UTC (rev 774) @@ -108,6 +108,19 @@ String pattern = request.getParameter("pattern"); Banlist.getInstance().unban(pattern); } + else if ("datasource.update".equals(action)) + { + DataSourceConfig datasourceConfig = new DataSourceConfig(); + datasourceConfig.setDriver(request.getParameter("driver")); + datasourceConfig.setUrl(request.getParameter("url")); + datasourceConfig.setUsername(request.getParameter("username")); + datasourceConfig.setPassword(request.getParameter("password")); + datasourceConfig.setMinIdle(Integer.parseInt(request.getParameter("minIdle"))); + datasourceConfig.setMaxActive(Integer.parseInt(request.getParameter("maxActive"))); + + config.setDataSource(datasourceConfig); + DataSourceManager.getInstance().setDataSource(datasourceConfig); + } else if ("gc".equals(action)) { System.gc(); Modified: jetrix/trunk/src/admin/server.jsp =================================================================== --- jetrix/trunk/src/admin/server.jsp 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/src/admin/server.jsp 2008-11-11 23:12:19 UTC (rev 774) @@ -40,8 +40,8 @@ <table class="thin" style="width: 600px"> <tr> - <td width="20%">Version</td> - <td width="80%"> + <th width="25%">Version</th> + <td width="75%"> <%= ServerConfig.VERSION %> <% if (VersionService.isNewVersionAvailable()) { %> <span style="color: red; padding-left: 2em">new version available (<%= VersionService.getLatestVersion() %>), <a href="http://jetrix.sourceforge.net">download it</a> now!</span> @@ -49,11 +49,11 @@ </td> </tr> <tr> - <td>Name</td> + <th>Name</th> <td><input class="thin" type="text" name="name" value="<%= conf.getName() != null ? conf.getName() : "" %>"></td> </tr> <tr> - <td>Host</td> + <th>Host</th> <td> <select name="host"> <option value="[ALL]">All Interfaces</option> @@ -79,28 +79,26 @@ </td> </tr> <tr> - <td>Max Players</td> + <th>Max Players</th> <td><input class="thin" type="text" name="maxPlayers" value="<%= conf.getMaxPlayers() %>"></td> </tr> <tr> - <td>Max Connections</td> + <th>Max Connections</th> <td><input class="thin" type="text" name="maxConnections" value="<%= conf.getMaxConnections() %>"></td> </tr> <tr> - <td>Operator Password</td> + <th>Operator Password</th> <td><input class="thin" type="text" name="opPassword" value="<%= conf.getOpPassword() != null ? conf.getOpPassword() : "" %>"></td> </tr> <tr> - <td>Administrator Password</td> + <th>Administrator Password</th> <td><input class="thin" type="text" name="adminPassword" value="<%= conf.getAdminPassword() != null ? conf.getAdminPassword() : "" %>"></td> </tr> <tr> - <td>Default Language</td> + <th>Default Language</th> <td> -<% Iterator locales = Language.getLocales().iterator(); %> <select class="thin" name="locale"> -<% while (locales.hasNext()) { - Locale locale = (Locale) locales.next(); %> +<% for (Locale locale : Language.getLocales()) { %> <option value="<%= locale.getLanguage() %>" <%= conf.getLocale().equals(locale) ? "selected" : "" %>> <%= locale.getLanguage().toUpperCase() %> - <%= locale.getDisplayLanguage() %> </option> @@ -109,7 +107,7 @@ </td> </tr> <tr> - <td>Status</td> + <th>Status</th> <td> <table> <tr> @@ -122,7 +120,7 @@ </td> </tr> <tr> - <td valign="top">Message of the day</td> + <th valign="top">Message of the day</th> <td><textarea class="thin" name="motd" cols="20" rows="5" style="width: 100%"><%= conf.getMessageOfTheDay() %></textarea></td> </tr> </table> @@ -391,21 +389,62 @@ <table class="thin" style="width: 400px"> <tr> - <td width="30%">Uptime</td> + <th width="35%">Uptime</th> <td><%= conf.getStatistics().getUpTime() %> day<%= conf.getStatistics().getUpTime() > 1 ? "s" : "" %></td> </tr> <tr> - <td>Number of Connections</td> + <th>Number of Connections</th> <td><%= conf.getStatistics().getConnectionCount() %></td> </tr> <tr> - <td>Games Played</td> + <th>Games Played</th> <td><%= conf.getStatistics().getGameCount() %></td> </tr> </table> </div> + <div class="tab-page" style="height: 400px"> + <h2 class="tab">Database</h2> + + <form id="datasource" action="/servlet/<%= ServerAction.class.getName() %>"> + <input type="hidden" name="action" value="datasource.update"> + + <table class="thin" style="width: 400px"> + <tr> + <th width="30%">Driver</th> + <td><input class="thin" type="text" name="driver" value="<%= conf.getDataSource().getDriver() %>" style="width: 98%"></td> + </tr> + <tr> + <th>URL</th> + <td><input class="thin" type="text" name="url" value="<%= conf.getDataSource().getUrl() %>" style="width: 98%"></td> + </tr> + <tr> + <th>Username</th> + <td><input class="thin" type="text" name="username" value="<%= conf.getDataSource().getUsername() %>"></td> + </tr> + <tr> + <th>Password</th> + <td><input class="thin" type="text" name="password" value="<%= conf.getDataSource().getPassword() %>"></td> + </tr> + <tr> + <th>Min Idle</th> + <td><input class="thin" type="text" name="minIdle" value="<%= conf.getDataSource().getMinIdle() %>"></td> + </tr> + <tr> + <th>Max Active</th> + <td><input class="thin" type="text" name="maxActive" value="<%= conf.getDataSource().getMaxActive() %>"></td> + </tr> + </table> + + <br> + + <input type="submit" value="Update"> + + </form> + </div> + + <div class="tab-page" style="height: 400px"> <h2 class="tab">System</h2> <% @@ -417,7 +456,7 @@ <table class="thin" style="width: 600px"> <tr> - <td width="30%">Java Virtual Machine</td> + <th width="30%">Java Virtual Machine</th> <td> <%= System.getProperty("java.vm.name") %> (build <%= System.getProperty("java.vm.version") %>, @@ -425,14 +464,14 @@ </td> </tr> <tr> - <td>Java Runtime Environment</td> + <th>Java Runtime Environment</th> <td> <%= System.getProperty("java.runtime.name") %> (build <%= System.getProperty("java.vm.version") %>) </td> </tr> <tr> - <td>Operating System</td> + <th>Operating System</th> <td> <%= System.getProperty("os.name") %> <%= System.getProperty("os.version") %> @@ -440,7 +479,7 @@ </td> </tr> <tr> - <td>Processor(s)</td> + <th>Processor(s)</th> <td><%= runtime.availableProcessors() %></td> </tr> </table> @@ -450,15 +489,15 @@ <table class="thin" style="width: 600px"> <tr> - <td width="30%">Total Memory</td> + <th width="30%">Total Memory</th> <td><%= df.format(runtime.totalMemory()/1024d/1024d) %> Mb</td> </tr> <tr> - <td>Max Memory</td> + <th>Max Memory</th> <td><%= df.format(runtime.maxMemory()/1024d/1024d) %> Mb</td> </tr> <tr> - <td>Free Memory</td> + <th>Free Memory</th> <td><%= df.format(runtime.freeMemory()/1024d/1024d) %> Mb</td> </tr> </table> Modified: jetrix/trunk/src/etc/tetrinet-server.dtd =================================================================== --- jetrix/trunk/src/etc/tetrinet-server.dtd 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/src/etc/tetrinet-server.dtd 2008-11-11 23:12:19 UTC (rev 774) @@ -67,8 +67,10 @@ <!ELEMENT nick (#PCDATA)> <!ELEMENT team (#PCDATA)> -<!ELEMENT datasource (driver, url, username, password?)> +<!ELEMENT datasource (driver, url, username, password?, min-idle?, max-active?)> <!ELEMENT driver (#PCDATA)> <!ELEMENT url (#PCDATA)> <!ELEMENT username (#PCDATA)> <!ELEMENT password (#PCDATA)> +<!ELEMENT min-idle (#PCDATA)> +<!ELEMENT max-active (#PCDATA)> Added: jetrix/trunk/src/java/net/jetrix/DataSourceManager.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/DataSourceManager.java (rev 0) +++ jetrix/trunk/src/java/net/jetrix/DataSourceManager.java 2008-11-11 23:12:19 UTC (rev 774) @@ -0,0 +1,128 @@ +/** + * 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; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.sql.SQLException; +import javax.sql.DataSource; + +import org.apache.commons.dbcp.BasicDataSource; + +import net.jetrix.config.DataSourceConfig; + +/** + * Manage the connection pools to the databases. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + * @since 0.3 + */ +public final class DataSourceManager +{ + private Logger log = Logger.getLogger(getClass().getName()); + + private static DataSourceManager instance = new DataSourceManager(); + + private Map<String, DataSource> datasources = new HashMap<String, DataSource>(); + + /** Key of the default datasource. */ + private static final String DEFAULT_DATASOURCE = "DEFAULT"; + + private DataSourceManager() + { + } + + public static DataSourceManager getInstance() + { + return instance; + } + + /** + * Returns the default datasource. + */ + public DataSource getDataSource() + { + return getDataSource(DEFAULT_DATASOURCE); + } + + public DataSource getDataSource(String environnement) + { + return (DataSource) datasources.get(environnement); + } + + /** + * Configure the default datasource. + */ + public void setDataSource(DataSourceConfig config) + { + setDataSource(config, DEFAULT_DATASOURCE); + } + + /** + * Configure a datasource. + * + * @param config the configuration of the datasource + * @param environment the environment of the datasource + */ + public void setDataSource(DataSourceConfig config, String environment) + { + try + { + Class.forName(config.getDriver()); + } + catch (ClassNotFoundException e) + { + log.warning("Unable to find the database driver (" + config.getDriver() + "), put the related jar in the lib directory"); + return; + } + + try + { + // close the previous datasource if necessary + if (datasources.containsKey(environment)) + { + BasicDataSource datasource = (BasicDataSource) datasources.get(environment); + datasource.close(); + } + + BasicDataSource datasource = new BasicDataSource(); + datasource.setDefaultAutoCommit(false); + + datasource.setDriverClassName(config.getDriver()); + datasource.setUrl(config.getUrl()); + datasource.setUsername(config.getUsername()); + datasource.setPassword(config.getPassword()); + datasource.setMinIdle(config.getMinIdle() != 0 ? config.getMinIdle() : 1); + datasource.setMaxActive(config.getMaxActive() != 0 ? config.getMaxActive() : 50); + + // attempts to open the connection + datasource.getConnection().close(); + + datasources.put(environment, datasource); + } + catch (Exception e) + { + log.log(Level.SEVERE, "Unable to configure the datasource '" + environment + "'", e); + } + } +} Property changes on: jetrix/trunk/src/java/net/jetrix/DataSourceManager.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: jetrix/trunk/src/java/net/jetrix/Server.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Server.java 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/src/java/net/jetrix/Server.java 2008-11-11 23:12:19 UTC (rev 774) @@ -89,6 +89,13 @@ // prepare the loggers LogManager.init(); + + // open the database connection + if (config.getDataSource() != null) + { + log.info("Initializing the datasource..."); + DataSourceManager.getInstance().setDataSource(config.getDataSource()); + } // display the systray icon (windows only) SystrayManager.open(); Added: jetrix/trunk/src/java/net/jetrix/config/DataSourceConfig.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/DataSourceConfig.java (rev 0) +++ jetrix/trunk/src/java/net/jetrix/config/DataSourceConfig.java 2008-11-11 23:12:19 UTC (rev 774) @@ -0,0 +1,96 @@ +/** + * 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.config; + +/** + * Configuration for a pool of connections to a database. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class DataSourceConfig +{ + private String url; + private String driver; + private String username; + private String password; + private int minIdle; + private int maxActive; + + public String getUrl() + { + return url; + } + + public void setUrl(String url) + { + this.url = url; + } + + public String getDriver() + { + return driver; + } + + public void setDriver(String driver) + { + this.driver = driver; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public int getMinIdle() + { + return minIdle; + } + + public void setMinIdle(int minIdle) + { + this.minIdle = minIdle; + } + + public int getMaxActive() + { + return maxActive; + } + + public void setMaxActive(int maxActive) + { + this.maxActive = maxActive; + } +} Property changes on: jetrix/trunk/src/java/net/jetrix/config/DataSourceConfig.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2008-11-11 23:12:19 UTC (rev 774) @@ -67,11 +67,8 @@ private int status; private Statistics statistics; - // datasource parameters - private String dataSourceDriver; - private String dataSourceURL; - private String dataSourceUsername; - private String dataSourcePassword; + // datasource configuration + private DataSourceConfig datasourceConfig; private URL serverConfigURL; private URL channelsConfigURL; @@ -273,23 +270,47 @@ out.println(" </ban>"); out.println(); - out.println(" <!-- Database connection parameters -->"); - out.println(" <datasource>"); - out.println(" <!-- The class of the JDBC driver used -->"); - out.println(" <driver>" + dataSourceDriver + "</driver>"); - out.println(); - out.println(" <!-- The URL of the database (jdbc:<type>://<hostname>:<port>/<database>) -->"); - out.println(" <url>" + dataSourceURL + "</url>"); - out.println(); - out.println(" <!-- The username connecting to the database -->"); - out.println(" <username>" + dataSourceUsername + "</username>"); - out.println(); - out.println(" <!-- The password of the user -->"); - out.println(" <password>" + dataSourcePassword + "</password>"); - out.println(" </datasource>"); - out.println(); + if (datasourceConfig != null) + { + out.println(" <!-- Database connection parameters -->"); + out.println(" <datasource>"); + out.println(" <!-- The class of the JDBC driver used -->"); + out.println(" <driver>" + datasourceConfig.getDriver() + "</driver>"); + out.println(); + out.println(" <!-- The URL of the database (jdbc:<type>://<hostname>:<port>/<database>) -->"); + out.println(" <url>" + datasourceConfig.getUrl() + "</url>"); + out.println(); + out.println(" <!-- The username connecting to the database -->"); + out.println(" <username>" + datasourceConfig.getUsername() + "</username>"); + out.println(); + out.println(" <!-- The password of the user -->"); + if (datasourceConfig.getPassword() != null) + { + out.println(" <password>" + datasourceConfig.getPassword() + "</password>"); + } + else + { + out.println(" <password/>"); + } + if (datasourceConfig.getMinIdle() != 0) + { + out.println(); + out.println(" <!-- The minimum number of idle connections -->"); + out.println(" <min-idle>" + datasourceConfig.getMinIdle() + "</min-idle>"); + } + if (datasourceConfig.getMaxActive() != 0) + { + out.println(); + out.println(" <!-- The maximum number of active connections -->"); + out.println(" <max-active>" + datasourceConfig.getMaxActive() + "</max-active>"); + } + out.println(" </datasource>"); + out.println(); + } + out.println("</tetrinet-server>"); + out.flush(); out.close(); // save the channels.xml file @@ -911,65 +932,16 @@ /** * @since 0.3 */ - public String getDataSourceDriver() + public DataSourceConfig getDataSource() { - return dataSourceDriver; + return datasourceConfig; } /** * @since 0.3 */ - public void setDataSourceDriver(String driver) + public void setDataSource(DataSourceConfig datasourceConfig) { - this.dataSourceDriver = driver; + this.datasourceConfig = datasourceConfig; } - - /** - * @since 0.3 - */ - public String getDataSourceURL() - { - return dataSourceURL; - } - - /** - * @since 0.3 - */ - public void setDataSourceURL(String url) - { - this.dataSourceURL = url; - } - - /** - * @since 0.3 - */ - public String getDataSourceUsername() - { - return dataSourceUsername; - } - - /** - * @since 0.3 - */ - public void setDataSourceUsername(String username) - { - this.dataSourceUsername = username; - } - - /** - * @since 0.3 - */ - public String getDataSourcePassword() - { - return dataSourcePassword; - } - - /** - * @since 0.3 - */ - public void setDataSourcePassword(String password) - { - this.dataSourcePassword = password; - } - } Modified: jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java 2008-11-11 23:03:21 UTC (rev 773) +++ jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java 2008-11-11 23:12:19 UTC (rev 774) @@ -74,10 +74,14 @@ digester.addCallMethod("tetrinet-server/ban/host", "addBannedHost", 0); // datasource - digester.addCallMethod("*/datasource/driver", "setDataSourceDriver", 0); - digester.addCallMethod("*/datasource/url", "setDataSourceURL", 0); - digester.addCallMethod("*/datasource/username", "setDataSourceUsername", 0); - digester.addCallMethod("*/datasource/password", "setDataSourcePassword", 0); + digester.addObjectCreate("*/datasource", "net.jetrix.config.DataSourceConfig"); + digester.addSetNext("*/datasource", "setDataSource", "net.jetrix.config.DataSourceConfig"); + digester.addCallMethod("*/datasource/driver", "setDriver", 0); + digester.addCallMethod("*/datasource/url", "setUrl", 0); + digester.addCallMethod("*/datasource/username", "setUsername", 0); + digester.addCallMethod("*/datasource/password", "setPassword", 0); + digester.addCallMethod("*/datasource/min-idle", "setMinIdle", 0); + digester.addCallMethod("*/datasource/max-active", "setMaxActive", 0); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-11-11 23:03:44
|
Revision: 773 http://jetrix.svn.sourceforge.net/jetrix/?rev=773&view=rev Author: smanux Date: 2008-11-11 23:03:21 +0000 (Tue, 11 Nov 2008) Log Message: ----------- Changed PropertyUtils to use a ConcurrentSkipListMap instead of a FastHashMap Modified Paths: -------------- jetrix/trunk/lib/commons-beanutils.jar Modified: jetrix/trunk/lib/commons-beanutils.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-11-11 18:04:32
|
Revision: 772 http://jetrix.svn.sourceforge.net/jetrix/?rev=772&view=rev Author: smanux Date: 2008-11-11 18:04:23 +0000 (Tue, 11 Nov 2008) Log Message: ----------- Moved the dependencies only used for the build into a different directory (follow up) Modified Paths: -------------- jetrix/trunk/build.xml Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-11-11 18:01:18 UTC (rev 771) +++ jetrix/trunk/build.xml 2008-11-11 18:04:23 UTC (rev 772) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="iso-8859-1"?> <project name="Jetrix TetriNET Server" default="dist" basedir="."> - <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="lib/Pack200Task.jar"/> + <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="lib/build/Pack200Task.jar"/> <property name="compile.debug" value="true"/> <property name="compile.optimize" value="false"/> @@ -254,7 +254,7 @@ <fileset dir="${src}/etc/control"/> </copy> - <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask" classpath="lib/jdeb-0.7-SNAPSHOT.jar"/> + <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask" classpath="lib/build/jdeb-0.7-SNAPSHOT.jar"/> <deb destfile="${dist}/bin/jetrix-${version}.deb" control="${build}/control" compression="bzip2"> <data src="${dist}/bin/jetrix-${version}.tar.bz2"> @@ -266,7 +266,7 @@ <target name="dist.win" depends="deploy" description="Build the Windows installer"> - <taskdef name="nsis" classname="net.sf.nsisant.Task" classpath="lib/nsisant-1.2.jar"/> + <taskdef name="nsis" classname="net.sf.nsisant.Task" classpath="lib/build/nsisant-1.2.jar"/> <condition property="nsis.home" value="C:\Program Files\NSIS" else="/usr/bin"> <os family="windows"/> </condition> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-11-11 18:01:48
|
Revision: 771 http://jetrix.svn.sourceforge.net/jetrix/?rev=771&view=rev Author: smanux Date: 2008-11-11 18:01:18 +0000 (Tue, 11 Nov 2008) Log Message: ----------- Moved the dependencies only used for the build into a different directory Added Paths: ----------- jetrix/trunk/lib/build/ jetrix/trunk/lib/build/Pack200Task.jar jetrix/trunk/lib/build/jdeb-0.7-SNAPSHOT.jar jetrix/trunk/lib/build/nsisant-1.2.jar Removed Paths: ------------- jetrix/trunk/lib/Pack200Task.jar jetrix/trunk/lib/jdeb-0.7-SNAPSHOT.jar jetrix/trunk/lib/nsisant-1.2.jar Deleted: jetrix/trunk/lib/Pack200Task.jar =================================================================== (Binary files differ) Copied: jetrix/trunk/lib/build/Pack200Task.jar (from rev 766, jetrix/trunk/lib/Pack200Task.jar) =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/build/Pack200Task.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: jetrix/trunk/lib/build/jdeb-0.7-SNAPSHOT.jar (from rev 766, jetrix/trunk/lib/jdeb-0.7-SNAPSHOT.jar) =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/build/jdeb-0.7-SNAPSHOT.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: jetrix/trunk/lib/build/nsisant-1.2.jar (from rev 766, jetrix/trunk/lib/nsisant-1.2.jar) =================================================================== (Binary files differ) Property changes on: jetrix/trunk/lib/build/nsisant-1.2.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: jetrix/trunk/lib/jdeb-0.7-SNAPSHOT.jar =================================================================== (Binary files differ) Deleted: jetrix/trunk/lib/nsisant-1.2.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-11-11 16:36:33
|
Revision: 770 http://jetrix.svn.sourceforge.net/jetrix/?rev=770&view=rev Author: smanux Date: 2008-11-11 16:36:23 +0000 (Tue, 11 Nov 2008) Log Message: ----------- Fixed OperatorCommand to set the correct access level (thanks to the tetrinet.de team) Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/commands/OperatorCommand.java Modified: jetrix/trunk/src/java/net/jetrix/commands/OperatorCommand.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/commands/OperatorCommand.java 2008-09-16 10:23:20 UTC (rev 769) +++ jetrix/trunk/src/java/net/jetrix/commands/OperatorCommand.java 2008-11-11 16:36:23 UTC (rev 770) @@ -59,7 +59,7 @@ if (password.equalsIgnoreCase(conf.getOpPassword())) { // access granted - client.getUser().setAccessLevel(1); + client.getUser().setAccessLevel(AccessLevel.OPERATOR); PlineMessage response = new PlineMessage(); response.setKey("command.operator.granted"); client.send(response); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-16 03:23:26
|
Revision: 769 http://jetrix.svn.sourceforge.net/jetrix/?rev=769&view=rev Author: smanux Date: 2008-09-16 10:23:20 +0000 (Tue, 16 Sep 2008) Log Message: ----------- Count only the players from the servers that are online Modified Paths: -------------- monitor/trunk/src/main/webapp/index.jsp Modified: monitor/trunk/src/main/webapp/index.jsp =================================================================== --- monitor/trunk/src/main/webapp/index.jsp 2008-09-02 21:41:15 UTC (rev 768) +++ monitor/trunk/src/main/webapp/index.jsp 2008-09-16 10:23:20 UTC (rev 769) @@ -18,9 +18,9 @@ for (ServerInfo server : servers) { if (server.isOnline()) { serverCount++; + totalPlayerCount += server.getStats().getPlayerCount(); } - - totalPlayerCount += server.getStats().getPlayerCount(); + if (lastChecked == null || (server.getLastChecked() != null && server.getLastChecked().after(lastChecked))) { lastChecked = server.getLastChecked(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 21:41:31
|
Revision: 768 http://jetrix.svn.sourceforge.net/jetrix/?rev=768&view=rev Author: smanux Date: 2008-09-02 21:41:15 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Removed the dependency on Commons Collections Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/lib/commons-digester.jar jetrix/trunk/pom.xml jetrix/trunk/src/java/net/jetrix/Channel.java jetrix/trunk/src/java/net/jetrix/ClientRepository.java jetrix/trunk/src/java/net/jetrix/commands/CommandManager.java jetrix/trunk/src/java/net/jetrix/filter/CommandFilter.java jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java jetrix/trunk/src/java/net/jetrix/messages/ChannelMessage.java jetrix/trunk/src/java/net/jetrix/protocols/IRCProtocol.java Added Paths: ----------- jetrix/trunk/project.properties Removed Paths: ------------- jetrix/trunk/lib/commons-collections.jar Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/build.xml 2008-09-02 21:41:15 UTC (rev 768) @@ -149,7 +149,6 @@ <!-- Pack the dependencies --> <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-digester"/></antcall> - <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-collections"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-beanutils"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-lang-2.0-light"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="jetty"/></antcall> Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/pom.xml 2008-09-02 21:41:15 UTC (rev 768) @@ -93,12 +93,6 @@ <dependencies> <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>2.1</version> - </dependency> - - <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.0</version> Added: jetrix/trunk/project.properties =================================================================== --- jetrix/trunk/project.properties (rev 0) +++ jetrix/trunk/project.properties 2008-09-02 21:41:15 UTC (rev 768) @@ -0,0 +1,2 @@ +version=0.3-dev +version.stable=0.2.3 Property changes on: jetrix/trunk/project.properties ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: jetrix/trunk/src/java/net/jetrix/Channel.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Channel.java 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/src/java/net/jetrix/Channel.java 2008-09-02 21:41:15 UTC (rev 768) @@ -33,8 +33,6 @@ import net.jetrix.winlist.*; import net.jetrix.clients.TetrinetClient; -import org.apache.commons.collections.*; - /** * Game channel. * @@ -614,14 +612,14 @@ { // players... JoinMessage mjoin2 = new JoinMessage(); - mjoin2.setChannel(this); + mjoin2.setChannelName(getConfig().getName()); mjoin2.setSlot(i + 1); mjoin2.setName(resident.getUser().getName()); // NPE client.send(mjoin2); // ...and teams TeamMessage mteam = new TeamMessage(); - mteam.setChannel(this); + mteam.setChannelName(getConfig().getName()); mteam.setSource(resident); mteam.setSlot(i + 1); mteam.setName(resident.getUser().getTeam()); @@ -685,7 +683,7 @@ if (gameState != STOPPED) { IngameMessage ingame = new IngameMessage(); - ingame.setChannel(this); + ingame.setChannelName(getConfig().getName()); client.send(ingame); // tell the player if the game is currently paused @@ -1041,7 +1039,17 @@ */ public Iterator<Client> getSpectators() { - return new FilterIterator(clients.iterator(), ClientRepository.SPECTATOR_PREDICATE); + List<Client> spectators = new ArrayList<Client>(); + + for (Client client : clients) + { + if (client.getUser().isSpectator()) + { + spectators.add(client); + } + } + + return spectators.iterator(); } /** Modified: jetrix/trunk/src/java/net/jetrix/ClientRepository.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/ClientRepository.java 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/src/java/net/jetrix/ClientRepository.java 2008-09-02 21:41:15 UTC (rev 768) @@ -19,11 +19,14 @@ package net.jetrix; -import java.net.*; -import java.util.*; +import java.net.InetAddress; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.List; +import java.util.ArrayList; +import java.util.concurrent.ConcurrentSkipListMap; -import org.apache.commons.collections.*; - /** * Repository of clients connected to the server. * @@ -33,40 +36,10 @@ public class ClientRepository { private static ClientRepository instance = new ClientRepository(); - private Map<String, Client> clients; + private Map<String, Client> clients = new ConcurrentSkipListMap<String, Client>(); - public static final Predicate PLAYER_PREDICATE = new Predicate() - { - public boolean evaluate(Object obj) - { - Client client = (Client) obj; - return client.getUser().isPlayer(); - } - }; - - public static final Predicate SPECTATOR_PREDICATE = new Predicate() - { - public boolean evaluate(Object obj) - { - Client client = (Client) obj; - return client.getUser().isSpectator(); - } - }; - - public static final Predicate OPERATOR_PREDICATE = new Predicate() - { - public boolean evaluate(Object obj) - { - Client client = (Client) obj; - return client.getUser().getAccessLevel() > 0; - } - }; - private ClientRepository() { - FastTreeMap map = new FastTreeMap(); - map.setFast(true); - clients = map; } public static ClientRepository getInstance() @@ -105,7 +78,17 @@ */ public Iterator<Client> getPlayers() { - return new FilterIterator(clients.values().iterator(), PLAYER_PREDICATE); + List<Client> player = new ArrayList<Client>(); + + for (Client client : clients.values()) + { + if (client.getUser().isPlayer()) + { + player.add(client); + } + } + + return player.iterator(); } /** @@ -113,7 +96,16 @@ */ public int getPlayerCount() { - return CollectionUtils.select(clients.values(), PLAYER_PREDICATE).size(); + int count = 0; + for (Client client : clients.values()) + { + if (client.getUser().isPlayer()) + { + count++; + } + } + + return count; } /** @@ -121,7 +113,17 @@ */ public Iterator<Client> getSpectators() { - return new FilterIterator(clients.values().iterator(), SPECTATOR_PREDICATE); + List<Client> spectators = new ArrayList<Client>(); + + for (Client client : clients.values()) + { + if (client.getUser().isSpectator()) + { + spectators.add(client); + } + } + + return spectators.iterator(); } /** @@ -129,7 +131,16 @@ */ public int getSpectatorCount() { - return CollectionUtils.select(clients.values(), SPECTATOR_PREDICATE).size(); + int count = 0; + for (Client client : clients.values()) + { + if (client.getUser().isSpectator()) + { + count++; + } + } + + return count; } /** @@ -137,7 +148,17 @@ */ public Iterator<Client> getOperators() { - return new FilterIterator(clients.values().iterator(), OPERATOR_PREDICATE); + List<Client> operators = new ArrayList<Client>(); + + for (Client client : clients.values()) + { + if (client.getUser().getAccessLevel() > 0) + { + operators.add(client); + } + } + + return operators.iterator(); } /** Modified: jetrix/trunk/src/java/net/jetrix/commands/CommandManager.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/commands/CommandManager.java 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/src/java/net/jetrix/commands/CommandManager.java 2008-09-02 21:41:15 UTC (rev 768) @@ -21,8 +21,6 @@ import java.util.*; -import org.apache.commons.collections.*; - import net.jetrix.*; import net.jetrix.messages.*; @@ -142,16 +140,17 @@ */ public Iterator<Command> getCommands(final int accessLevel) { - Predicate availableToLevel = new Predicate() + List<Command> commands = new ArrayList<Command>(); + + for (Command command : commandSet.values()) { - public boolean evaluate(Object obj) + if (command.getAccessLevel() <= accessLevel) { - Command command = (Command) obj; - return command.getAccessLevel() <= accessLevel; + commands.add(command); } - }; + } - return new FilterIterator(commandSet.values().iterator(), availableToLevel); + return commands.iterator(); } /** Modified: jetrix/trunk/src/java/net/jetrix/filter/CommandFilter.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/filter/CommandFilter.java 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/src/java/net/jetrix/filter/CommandFilter.java 2008-09-02 21:41:15 UTC (rev 768) @@ -22,6 +22,7 @@ import java.util.*; import java.util.logging.*; +import net.jetrix.Message; import net.jetrix.messages.*; import net.jetrix.commands.*; @@ -59,9 +60,8 @@ } } - public void onMessage(CommandMessage m, List out) + public void onMessage(CommandMessage m, List<Message> out) { - for (String alias : command.getAliases()) { if (m.getCommand().equals(alias)) Modified: jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2008-09-02 21:41:15 UTC (rev 768) @@ -91,7 +91,7 @@ InetAddress address = socket.getInetAddress(); // log the connection - log.info("Incoming client " + address.getHostAddress() + ":" + socket.getPort()); + log.info("Incoming " + getName() + " client " + address.getHostAddress() + ":" + socket.getPort()); // test the ban list if (Banlist.getInstance().isBanned(address)) Modified: jetrix/trunk/src/java/net/jetrix/messages/ChannelMessage.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/messages/ChannelMessage.java 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/src/java/net/jetrix/messages/ChannelMessage.java 2008-09-02 21:41:15 UTC (rev 768) @@ -30,6 +30,7 @@ public abstract class ChannelMessage extends Message { private int slot; + private String channelName; public int getSlot() { @@ -41,13 +42,13 @@ this.slot = slot; } - public Channel getChannel() + public String getChannelName() { - return (Channel) getDestination(); + return channelName; } - public void setChannel(Channel channel) + public void setChannelName(String channelName) { - setDestination(channel); + this.channelName = channelName; } } Modified: jetrix/trunk/src/java/net/jetrix/protocols/IRCProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/IRCProtocol.java 2008-09-02 19:42:47 UTC (rev 767) +++ jetrix/trunk/src/java/net/jetrix/protocols/IRCProtocol.java 2008-09-02 21:41:15 UTC (rev 768) @@ -144,12 +144,7 @@ message.setNick("jetrix"); } - Channel channel = m.getChannel(); - String name = "#jetrix"; - if (channel != null) - { - name = "#" + channel.getConfig().getName(); - } + String name = m.getChannelName() == null ? "#jetrix" : "#" + m.getChannelName(); message.addParameter(name); message.addParameter(applyStyle(m.getText(locale))); @@ -171,12 +166,7 @@ message.setNick("jetrix"); } - Channel channel = m.getChannel(); - String name = "#jetrix"; - if (channel != null) - { - name = "#" + channel.getConfig().getName(); - } + String name = m.getChannelName() == null ? "#jetrix" : "#" + m.getChannelName(); message.addParameter(name); message.addParameter(applyStyle("\u0001ACTION " + m.getText(locale) + "\u0001")); @@ -198,12 +188,7 @@ message.setNick("jetrix"); } - Channel channel = m.getChannel(); - String name = "#jetrix"; - if (channel != null) - { - name = "#" + channel.getConfig().getName(); - } + String name = m.getChannelName() == null ? "#jetrix" : "#" + m.getChannelName(); // todo remove the <name> of the player at the beginning of the message @@ -239,7 +224,7 @@ IRCMessage message = new IRCMessage(IRCCommand.PRIVMSG); message.setNick("jetrix"); - message.addParameter("#" + m.getChannel().getConfig().getName()); + message.addParameter("#" + m.getChannelName()); String messageKey = m.getName() == null ? "channel.team.none" : "channel.team.new"; Object[] params = new Object[] { client.getUser().getName(), m.getName() }; @@ -252,7 +237,7 @@ { IRCMessage message = new IRCMessage(IRCCommand.JOIN); message.setNick(m.getName()); - message.addParameter("#" + m.getChannel().getConfig().getName()); + message.addParameter("#" + m.getChannelName()); return message.toString(); } @@ -261,7 +246,7 @@ { IRCMessage message = new IRCMessage(IRCCommand.PART); message.setNick(m.getName()); - message.addParameter("#" + m.getChannel().getConfig().getName()); + message.addParameter("#" + m.getChannelName()); return message.toString(); } @@ -270,7 +255,7 @@ { IRCMessage message = new IRCMessage(IRCCommand.PRIVMSG); message.setNick("jetrix"); - message.addParameter("#" + m.getChannel().getConfig().getName()); + message.addParameter("#" + m.getChannelName()); message.addParameter(applyStyle(Language.getText("channel.game.start", locale))); return message.toString(); @@ -280,7 +265,7 @@ { IRCMessage message = new IRCMessage(IRCCommand.PRIVMSG); message.setNick("jetrix"); - message.addParameter("#" + m.getChannel().getConfig().getName()); + message.addParameter("#" + m.getChannelName()); message.addParameter(applyStyle(Language.getText("channel.game.stop", locale))); return message.toString(); @@ -290,7 +275,7 @@ { IRCMessage message = new IRCMessage(IRCCommand.PRIVMSG); message.setNick("jetrix"); - message.addParameter("#" + m.getChannel().getConfig().getName()); + message.addParameter("#" + m.getChannelName()); message.addParameter(applyStyle(Language.getText("channel.game.running", locale))); return message.toString(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 19:42:55
|
Revision: 767 http://jetrix.svn.sourceforge.net/jetrix/?rev=767&view=rev Author: smanux Date: 2008-09-02 19:42:47 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Removed the Maven 1 build Removed Paths: ------------- jetrix/trunk/project.properties jetrix/trunk/project.xml jetrix/trunk/src/etc/clover.license Deleted: jetrix/trunk/project.properties =================================================================== --- jetrix/trunk/project.properties 2008-09-02 18:17:42 UTC (rev 766) +++ jetrix/trunk/project.properties 2008-09-02 19:42:47 UTC (rev 767) @@ -1,22 +0,0 @@ -version=0.3-dev -version.stable=0.2.3 - -maven.junit.fork=true -maven.junit.dir=target/test-classes -maven.test.failure.ignore=true - -maven.changelog.range=365 - -maven.jar.override=on -maven.jar.jcrontab=lib/jcrontab-1.4.1-light.jar - -maven.javadoc.use=false -maven.javadoc.links=http://java.sun.com/j2se/1.5/docs/api/, http://jetty.mortbay.org/javadoc/, http://jakarta.apache.org/commons/digester/apidocs/, http://jakarta.apache.org/commons/collections/apidocs/, http://jakarta.apache.org/commons/lang/apidocs/ -maven.javadoc.stylesheet=doc/javadoc-stylesheet.css - -maven.compile.source = 1.5 -maven.compile.target = 1.5 - -maven.clover.license.path=src/etc/clover.license - -maven.repo.remote=http://repo1.maven.org/maven/ Deleted: jetrix/trunk/project.xml =================================================================== --- jetrix/trunk/project.xml 2008-09-02 18:17:42 UTC (rev 766) +++ jetrix/trunk/project.xml 2008-09-02 19:42:47 UTC (rev 767) @@ -1,223 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<project> - <pomVersion>3</pomVersion> - <name>Jetrix TetriNET Server</name> - <id>jetrix</id> - <currentVersion>${version}</currentVersion> - - <organization> - <logo>http://jetrix.sourceforge.net/images/jetrix-logo.png</logo> - <name>Emmanuel Bourg</name> - </organization> - - <inceptionYear>2001</inceptionYear> - <package>net.jetrix</package> - - <shortDescription>Jetrix TetriNET Server</shortDescription> - - <description> - 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 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 - developped under the GNU General Public License. - </description> - - <url>http://jetrix.sourceforge.net</url> - <issueTrackingUrl>https://sourceforge.net/tracker/?group_id=52188&atid=466002</issueTrackingUrl> - <siteAddress>shell.sourceforge.net</siteAddress> - <siteDirectory>/home/groups/j/je/jetrix/htdocs/docs/</siteDirectory> - - <repository> - <connection>scm:svn:https://jetrix.svn.sourceforge.net/svnroot/jetrix/jetrix/trunk/</connection> - <developerConnection>scm:svn:https://jetrix.svn.sourceforge.net/svnroot/jetrix/jetrix/trunk/</developerConnection> - <url>http://jetrix.svn.sourceforge.net/viewvc/jetrix/</url> - </repository> - - <versions> - <version> - <id>0.1.3</id> - <name>0.1.3</name> - <tag>jetrix_0_1_3</tag> - </version> - <version> - <id>0.1.2</id> - <name>0.1.2</name> - <tag>jetrix_0_1_2</tag> - </version> - <version> - <id>0.1.1</id> - <name>0.1.1</name> - <tag>jetrix_0_1_1</tag> - </version> - <version> - <id>0.1.0</id> - <name>0.1.0</name> - <tag>jetrix_0_1_0</tag> - </version> - </versions> - - <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> - <name>Emmanuel Bourg</name> - <id>smanux</id> - <email>sm...@lf...</email> - <organization>LFJR - Ligue Francophone de Jeux en R\xE9seau</organization> - </developer> - </developers> - - <contributors> - <contributor> - <name>Tim Van Wassenhove</name> - <roles> - <role>Dutch translator</role> - </roles> - </contributor> - <contributor> - <name>Mario Meuser</name> - <roles> - <role>German translator</role> - </roles> - </contributor> - <contributor> - <name>Julian Mesa Llopis</name> - <roles> - <role>Spanish translator</role> - </roles> - </contributor> - <contributor> - <name>Bryan Reynaert</name> - <roles> - <role>Spanish translator</role> - </roles> - </contributor> - <contributor> - <name>Claudio Gargiulo</name> - <roles> - <role>Italian translator</role> - </roles> - </contributor> - <contributor> - <name>V\xEDtor Melo</name> - <roles> - <role>Portuguese translator</role> - </roles> - </contributor> - </contributors> - - <licenses> - <license> - <name>GNU General Public License, Version 2</name> - <url>/doc/license.txt</url> - <distribution>manual</distribution> - </license> - </licenses> - - <dependencies> - <dependency> - <id>commons-collections</id> - <version>2.1</version> - </dependency> - - <dependency> - <id>commons-lang</id> - <version>2.0</version> - </dependency> - - <dependency> - <id>commons-logging</id> - <version>1.0.3</version> - </dependency> - - <dependency> - <id>commons-digester</id> - <version>1.5</version> - </dependency> - - <dependency> - <id>commons-beanutils</id> - <version>1.7.0</version> - </dependency> - - <dependency> - <id>jetty</id> - <version>4.1-rc1</version> - </dependency> - - <dependency> - <id>jcrontab</id> - <version>1.4.1</version> - </dependency> - - <!-- Needed for testing --> - <dependency> - <id>junit</id> - <version>3.8.1</version> - <url>http://www.junit.org</url> - </dependency> - - </dependencies> - - <build> - <sourceDirectory>src/java</sourceDirectory> - <unitTestSourceDirectory>src/test</unitTestSourceDirectory> - - <!-- Unit test classes --> - <unitTest> - <includes> - <include>**/*Test.java</include> - </includes> - <resources> - <resource> - <directory>src/etc</directory> - <targetPath>/</targetPath> - <includes> - <include>*.xml</include> - <include>*.dtd</include> - </includes> - </resource> - <resource> - <directory>src/lang</directory> - <targetPath>/</targetPath> - <includes> - <include>*.properties</include> - </includes> - </resource> - <resource> - <directory>src/etc/data/puzzle</directory> - <targetPath>/data/puzzle</targetPath> - <includes> - <include>*.field</include> - <include>*.settings</include> - </includes> - </resource> - </resources> - </unitTest> - - </build> - - <reports> - <!--<report>maven-statcvs-plugin</report>--> - <report>maven-changes-plugin</report> - <report>maven-javadoc-plugin</report> - <!--<report>maven-jxr-plugin</report>--> - <report>maven-junit-report-plugin</report> - <!--<report>maven-clover-plugin</report>--> - <!--<report>maven-checkstyle-plugin</report>--> - <report>maven-pmd-plugin</report> - <report>maven-simian-plugin</report> - </reports> - -</project> Deleted: jetrix/trunk/src/etc/clover.license =================================================================== --- jetrix/trunk/src/etc/clover.license 2008-09-02 18:17:42 UTC (rev 766) +++ jetrix/trunk/src/etc/clover.license 2008-09-02 19:42:47 UTC (rev 767) @@ -1,165 +0,0 @@ -Product: Clover -License: Open Source License, 0.x, 1.x -Issued: Mon Sep 1 2003 01:36:08 CDT -Expiry: Never -Key: 9860a7991bd1927a59fa014c4 -Name: Emmanuel Bourg -Org: Jetrix Tetrinet Server -Certificate: AAABxG+Ow8B7/zEbxOMqqKwwrdpP+a1COmJGHco7sCNLjHkHnajPF+dQW -Ct12PMy0uml0s9xuus5wKngJ9OFk5XFeh01dzQF66bhXH1bvegLfvja3Kle6BYtDv4LZgE -gk3E0aJN4IbgTn+TgUckSevXDR4KzK77NWJfrVzkxV3/JepY1WvQgUcXQilK7QTwBcZ3Od -/PwtdKMROjIOsav+nqW28rPvCoDOXEpG/GxuA4RC5riWXzv3ZnKQr8IOhO1LXIBKpNWND2 -SbjToMITzpUvSEnrjw1aOrDCr0lidvwM5dwNdyS6uOVamHUyR9oZIrFxyN2DP63fzpr/Ow -G20rTrFr7MgxPrHrLlvHTJ9PxC/oOoUEiGp4UV+79fJykPmRUIIpjZ7DSDSVjJyjyZO8Cu -b67hLyAI/jd5Nh/0rqcpY+aNKJWVTc8pnqCJb40NFjOeKSLpNfA12zuh35bvhkJomqZ5ok -vq2bYO7qMWgZBsxcThI0rj9AARO+fhfeePbmctF6whyU+wzYRNg0Ec1bJR6avswm6fjUMh -XN+jURcupMb3QT56qVz9+TTfNOLMlWqYKRYryilTnIjoNdsn1Zuzq7dTeYf+tVIfIf+gSu -YZ8scRKj7QNiqP52718muMWBetR0UIXuWfj0jNXGuyP7QMm0ZjyuG3YVlwmoG1s5Qft8mt -kTNfmohTZo735HGjKoWUpX2IaA6FgMam9e0lBaTAjVO2+ejmdQXEHH7gRAWGUFhcflKC8o -CtGNP93xFQYtrDGPEzUaQA= -License Agreement: CLOVER VERSION 1 (ONE) SOFTWARE LICENSE AGREEMENT - -1. Licenses and Software - -Cortex eBusiness Pty Ltd, an Australian Proprietary Limited Company -("CENQUA") hereby grants to the purchaser (the "LICENSEE") a limited, -revocable, worldwide, non-exclusive, non-transferable, -non-sublicensable license to use the Clover version 1 (one) software -(the "Software"), including any minor upgrades thereof during the Term -(hereinafter defined) up to, but not including the next major version -of the Software. The licensee shall not, or knowingly allow others to, -reverse engineer, decompile, disassemble, modify, adapt, create -derivative works from or otherwise attempt to derive source code from -the Software provided. And, in accordance with the terms and -conditions of this Software License Agreement (the "Agreement"), the -Software shall be used solely by the licensed users in accordance with -the following edition specific conditions: - -a) Server Edition - -A Server Edition license entitles the Licensee to execute one instance -of Clover Server Edition on one (1) machine for the purposes of -instrumenting source code and generating reports. There are no -limitations on the use of the instrumented source code or generated -reports produced by Server Edition. - -b) Workstation Edition - -A Workstation Edition license entitles the licensee to use Clover -Workstation Edition on one (1) machine by one (1) individual end -user. Workstation Edition does not permit the generation of reports -for distribution. - -c) Team Edition - -A Team Edition license entitles the licensee to use Clover Team -edition on any number of machines solely by the licensed number of -users. Reports generated by Clover Team Edition are strictly for use -only by the licensed number of individual end users. - -2. License Fee - -In exchange for the License(s), the Licensee shall pay to Cenqua a -one-time, up front, non-refundable license fee. At the sole discretion -of Cenqua this fee will be waived for non-commercial -projects. Notwithstanding the Licensee's payment of the License Fee, -Cenqua reserves the right to terminate the License if Cenqua discovers -that the Licensee and/or the Licensee's use of the Software is in -breach of this Agreement. - -3. Proprietary Rights - -Cenqua will retain all right, title and interest in and to the -Software, all copies thereof, and Cenqua website(s), software, and -other intellectual property, including, but not limited to, ownership -of all copyrights, look and feel, trademark rights, design rights, -trade secret rights and any and all other intellectual property and -other proprietary rights therein. The Licensee will not directly or -indirectly obtain or attempt to obtain at any time, any right, title -or interest by registration or otherwise in or to the trademarks, -service marks, copyrights, trade names, symbols, logos or designations -or other intellectual property rights owned or used by Cenqua. All -technical manuals or other information provided by Cenqua to the -Licensee shall be the sole property of Cenqua. - -4. Term and Termination - -Subject to the other provisions hereof, this Agreement shall commence -upon the Licensee's opting into this Agreement and continue until the -Licensee discontinues use of the Software or the Agreement terminates -automatically upon the Licensee's breach of any term or condition of -this Agreement (the "Term"). Upon any such termination, the Licensee -will delete the Software immediately. - -5. Copying & Transfer - -The Licensee may copy the Software for back-up purposes only. The -Licensee may not assign or otherwise transfer the Software to any -third party. - -6. Specific Disclaimer of Warranty and Limitation of Liability - -THE SOFTWARE IS PROVIDED WITHOUT WARRANTY OF ANY KIND. CENQUA -DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE. CENQUA WILL NOT BE LIABLE FOR ANY DAMAGES -ASSOCIATED WITH THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ORDINARY, -INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING -BUT NOT LIMITED TO DAMAGES RELATING TO LOST DATA OR LOST PROFITS, EVEN -IF CENQUA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. Warranties and Representations - -Licensee Indemnification. CENQUA agrees to indemnify, defend and hold -the Licensee harmless from and against any and all liabilities, -damages, losses, claims, costs, and expenses (including reasonable -legal fees) arising out of or resulting from the Software or the use -thereof infringing upon, misappropriating or violating any patents, -copyrights, trademarks, or trade secret rights or other proprietary -rights of persons, firms or entities who are not parties to this -Agreement. - -CENQUA Indemnification. The Licensee warrants and represents that the -Licensee's actions with regard to the Software will be in compliance -with all applicable laws; and the Licensee agrees to indemnify, -defend, and hold CENQUA harmless from and against any and all -liabilities, damages, losses, claims, costs, and expenses (including -reasonable legal fees) arising out of or resulting from the -Licensee's failure to observe the use restrictions set forth herein. - -8. Publicity - -The Licensee grants permission for CENQUA to use Licensee's name -solely in customer lists. CENQUA shall not, without prior consent in -writing, use the Licensee's name, or that of its affiliates, in any -form with the specific exception of customer lists. CENQUA agrees to -remove Licensee's name from any and all materials within 7 days if -notified by the Licensee in writing. - -9. Governing Law - -This Agreement shall be governed by the laws of New South Wales, -Australia. - -10. Independent Contractors - -The parties are independent contractors with respect to each other, -and nothing in this Agreement shall be construed as creating an -employer-employee relationship, a partnership, agency relationship or -a joint venture between the parties. - -11. Assignment - -This Agreement is not assignable or transferable by the Licensee. -CENQUA in its sole discretion may transfer a license to a third party -at the written request of the Licensee. - -12. Entire Agreement - -This Agreement constitutes the entire agreement between the parties -concerning the Licensee's use of the Software. This Agreement -supersedes any prior verbal understanding between the parties and any -Licensee purchase order or other ordering document, regardless of -whether such document is received by CENQUA before or after execution -of this Agreement. This Agreement may be amended only in writing by -CENQUA. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 18:17:49
|
Revision: 766 http://jetrix.svn.sourceforge.net/jetrix/?rev=766&view=rev Author: smanux Date: 2008-09-02 18:17:42 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Moved the configuration to /etc/jetrix and the logs to /var/log/jetrix on Linux Modified Paths: -------------- jetrix/trunk/src/etc/control/postinst jetrix/trunk/src/etc/control/postrm Added Paths: ----------- jetrix/trunk/src/etc/control/conffiles Added: jetrix/trunk/src/etc/control/conffiles =================================================================== --- jetrix/trunk/src/etc/control/conffiles (rev 0) +++ jetrix/trunk/src/etc/control/conffiles 2008-09-02 18:17:42 UTC (rev 766) @@ -0,0 +1,2 @@ +/etc/jetrix/server.xml +/etc/jetrix/channels.xml Property changes on: jetrix/trunk/src/etc/control/conffiles ___________________________________________________________________ Added: svn:eol-style + LF Modified: jetrix/trunk/src/etc/control/postinst =================================================================== --- jetrix/trunk/src/etc/control/postinst 2008-09-02 18:06:09 UTC (rev 765) +++ jetrix/trunk/src/etc/control/postinst 2008-09-02 18:17:42 UTC (rev 766) @@ -1,5 +1,13 @@ #!/bin/sh -ln -s /usr/share/jetrix/jetrix /usr/bin/jetrix +JETRIX_HOME="/usr/share/jetrix"; -# TODO Move the log directory and create a symlink +ln -s $JETRIX_HOME/jetrix /usr/games/jetrix + +# move the conf directory to /etc/jetrix and create a symbolic link +mv $JETRIX_HOME/conf /etc/jetrix +ln -s /etc/jetrix $JETRIX_HOME/conf + +# move the log directory to /var/log/jetrix and create a symbolic link +mv $JETRIX_HOME/log /var/log/jetrix +ln -s /var/log/jetrix $JETRIX_HOME/log Modified: jetrix/trunk/src/etc/control/postrm =================================================================== --- jetrix/trunk/src/etc/control/postrm 2008-09-02 18:06:09 UTC (rev 765) +++ jetrix/trunk/src/etc/control/postrm 2008-09-02 18:17:42 UTC (rev 766) @@ -1,3 +1,3 @@ #!/bin/sh -rm -f /usr/bin/jetrix +rm -f /usr/games/jetrix This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 18:06:22
|
Revision: 765 http://jetrix.svn.sourceforge.net/jetrix/?rev=765&view=rev Author: smanux Date: 2008-09-02 18:06:09 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Removed bat files from the debian package when the package is built on Linux Modified Paths: -------------- jetrix/trunk/build.xml Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-09-02 17:48:20 UTC (rev 764) +++ jetrix/trunk/build.xml 2008-09-02 18:06:09 UTC (rev 765) @@ -260,7 +260,7 @@ <deb destfile="${dist}/bin/jetrix-${version}.deb" control="${build}/control" compression="bzip2"> <data src="${dist}/bin/jetrix-${version}.tar.bz2"> <mapper type="prefix" strip="1" prefix="/usr/share/jetrix"/> - <exclude name="*.bat"/> + <exclude name="**/*.bat"/> </data> </deb> </target> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 17:48:32
|
Revision: 764 http://jetrix.svn.sourceforge.net/jetrix/?rev=764&view=rev Author: smanux Date: 2008-09-02 17:48:20 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Moved the configuration files in a conf sub directory Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java Added Paths: ----------- jetrix/trunk/src/etc/conf/ jetrix/trunk/src/etc/conf/channels.xml jetrix/trunk/src/etc/conf/server.xml Removed Paths: ------------- jetrix/trunk/src/etc/channels.xml jetrix/trunk/src/etc/server.xml Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-09-02 17:26:49 UTC (rev 763) +++ jetrix/trunk/build.xml 2008-09-02 17:48:20 UTC (rev 764) @@ -182,8 +182,7 @@ <zipfileset prefix="jetrix-${version}/" dir="${src}/etc/"> <include name="LICENSE" /> <include name="README" /> - <include name="server.xml" /> - <include name="channels.xml" /> + <include name="conf/*" /> <include name="data/**" /> </zipfileset> <zipfileset prefix="jetrix-${version}/" dir="${build}/bin/"> @@ -215,8 +214,7 @@ <tarfileset prefix="jetrix-${version}/" dir="${src}/etc/"> <include name="LICENSE" /> <include name="README" /> - <include name="server.xml" /> - <include name="channels.xml" /> + <include name="conf/*" /> <include name="data/**" /> </tarfileset> <tarfileset prefix="jetrix-${version}/" dir="${build}/bin/"> Deleted: jetrix/trunk/src/etc/channels.xml =================================================================== --- jetrix/trunk/src/etc/channels.xml 2008-09-02 17:26:49 UTC (rev 763) +++ jetrix/trunk/src/etc/channels.xml 2008-09-02 17:48:20 UTC (rev 764) @@ -1,282 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE tetrinet-channels PUBLIC "-//LFJR//Jetrix Channels//EN" "http://jetrix.sourceforge.net/dtd/tetrinet-channels.dtd"> - -<tetrinet-channels> - - <!-- Message Of The Day --> - <motd><![CDATA[ -<b> -Welcome on <b>Jetrix TetriNET Server</b>! -<u><blue>http://jetrix.sourceforge.net/</blue></u> -<b> - ]]></motd> - - <!-- Channel filters --> - <filter-definitions> - <alias name="flood" class="net.jetrix.filter.FloodFilter"/> - <alias name="start" class="net.jetrix.filter.StartFilter"/> - <alias name="amplifier" class="net.jetrix.filter.AmplifierFilter"/> - <alias name="ping" class="net.jetrix.filter.PingFilter"/> - <alias name="7tetris" class="net.jetrix.filter.TetrisFilter"/> - <alias name="stats" class="net.jetrix.filter.StatsFilter"/> - <alias name="logo" class="net.jetrix.filter.LogoFilter"/> - <alias name="sudden-death" class="net.jetrix.filter.SuddenDeathFilter"/> - <alias name="command" class="net.jetrix.filter.CommandFilter"/> - <alias name="survival" class="net.jetrix.filter.SurvivalFilter"/> - <alias name="puzzle" class="net.jetrix.filter.PuzzleFilter"/> - <alias name="random" class="net.jetrix.filter.RandomFilter"/> - </filter-definitions> - - <!-- Global filters --> - <default-filters> - <filter name="flood"> - <param name="capacity" value="8"/> - <param name="delay" value="5000"/> - </filter> - <filter name="start"> - <param name="delay" value="10000"/> - </filter> - <filter name="ping"/> - <filter name="stats"/> - <filter name="logo"/> - <filter name="sudden-death"/> - </default-filters> - - <!-- Winlists --> - <winlists> - <winlist name="default" class="net.jetrix.winlist.SimpleWinlist"> - <param name="display.score" value="true"/> - </winlist> - <winlist name="pure" class="net.jetrix.winlist.SimpleWinlist"> - <param name="display.score" value="true"/> - </winlist> - <winlist name="duel" class="net.jetrix.winlist.SimpleWinlist"> - <param name="display.score" value="true"/> - </winlist> - </winlists> - - <!-- Default game settings --> - <default-settings> - <!-- What level each player starts at --> - <starting-level>1</starting-level> - - <!-- How many lines to make before player level increases --> - <lines-per-level>2</lines-per-level> - - <!-- Number of levels to increase each time --> - <level-increase>1</level-increase> - - <!-- Lines to make to get a special block --> - <lines-per-special>2</lines-per-special> - - <!-- Number of special blocks added each time --> - <special-added>1</special-added> - - <!-- Capacity of Special block inventory --> - <special-capacity>18</special-capacity> - - <!-- Play by classic rules? --> - <classic-rules>true</classic-rules> - - <!-- Average together all player's game level? --> - <average-levels>true</average-levels> - - <!-- Same sequence of blocks for all players? (tetrinet 1.14 clients only) --> - <same-blocks>true</same-blocks> - - <block-occurancy> - <line>15</line> - <square>15</square> - <leftl>14</leftl> - <rightl>14</rightl> - <leftz>14</leftz> - <rightz>14</rightz> - <halfcross>14</halfcross> - </block-occurancy> - - <special-occurancy> - <addline>31</addline> - <clearline>21</clearline> - <nukefield>1</nukefield> - <randomclear>13</randomclear> - <switchfield>1</switchfield> - <clearspecial>14</clearspecial> - <gravity>1</gravity> - <quakefield>7</quakefield> - <blockbomb>11</blockbomb> - </special-occurancy> - - <!-- Sudden death parameters --> - <sudden-death> - <!-- Time in seconds before the sudden death begins, 0 to disable the sudden death --> - <time>600</time> - - <!-- The message displayed when the sudden death begins. Use "key:" prefix to display an internationalized message --> - <message>key:filter.suddendeath.message</message> - - <!-- The delay in seconds between lines additions --> - <delay>10</delay> - - <!-- The number of lines added --> - <lines-added>1</lines-added> - </sudden-death> - - </default-settings> - - - <channels> - <channel name="tetrinet1"> - <description>2:1</description> - <winlist name="default"/> - </channel> - - <channel name="tetrinet2"> - <description>2:1</description> - <winlist name="default"/> - </channel> - - <channel name="tetrinet3"> - <description>2:1</description> - <winlist name="default"/> - </channel> - - <channel name="pure"> - <description>Pure</description> - <winlist name="pure"/> - <settings> - <special-added>0</special-added> - </settings> - </channel> - - <channel name="pure2"> - <description>Pure</description> - <winlist name="pure"/> - <settings> - <special-added>0</special-added> - </settings> - </channel> - - <channel name="custom"> - <description>Custom mode</description> - <topic>Type /mode to change the settings</topic> - <filters> - <filter name="command"> - <param name="class" value="net.jetrix.commands.ModeCommand"/> - </filter> - </filters> - </channel> - - <channel name="random"> - <description>Random settings</description> - <topic>New game, new settings. Enjoy!</topic> - <filters> - <filter name="random"/> - </filters> - </channel> - - <channel name="duel1"> - <description>Duel 2:1</description> - <max-players>2</max-players> - <winlist name="duel"/> - </channel> - - <channel name="duel2"> - <description>Duel 2:1</description> - <max-players>2</max-players> - <winlist name="duel"/> - </channel> - - <channel name="pureduel"> - <description>Pure - No Specials</description> - <max-players>2</max-players> - <winlist name="default"/> - <settings> - <special-added>0</special-added> - <same-blocks>true</same-blocks> - </settings> - </channel> - - <channel name="sticks"> - <description>Sticks Only</description> - <settings> - <special-added>0</special-added> - <block-occurancy> - <line>100</line> - </block-occurancy> - </settings> - </channel> - - <channel name="SnS"> - <description><![CDATA[Sticks <i>and</i> Squares]]></description> - <settings> - <special-added>0</special-added> - <block-occurancy> - <line>50</line> - <square>50</square> - </block-occurancy> - </settings> - </channel> - - <channel name="7Tetris"> - <description>7 tetris to win!</description> - <topic> -<![CDATA[ -<b> -Welcome to the 7 tetris channel! The first player completing 7 tetris -win. There is no special in this game, and the lines are not added to -your opponents. Good luck! -<b> -]]> - </topic> - <settings> - <special-added>0</special-added> - </settings> - <filters> - <filter name="7tetris"/> - </filters> - </channel> - - <channel name="survival"> - <description>Staying Aliiiive !!</description> - <topic> -<![CDATA[ -<b> -Welcome to the survival channel! Drop as many blocks as you can -before you die. The sudden death is activated immediately and one -line is added every 5 seconds. -If you clear <b>2</b> lines, <b>1</b> extra line will be removed. -If you clear <b>3</b> lines, <b>2</b> extra lines will be removed. -If you clear <b>4</b> lines, <b>3</b> extra additional lines will be removed. -<b> -]]> - </topic> - <max-players>2</max-players> - <settings> - <sudden-death> - <time>5</time> - <delay>5</delay> - <lines-added>1</lines-added> - </sudden-death> - </settings> - <filters> - <filter name="survival"/> - </filters> - </channel> - - <channel name="puzzle"> - <description>Downstack 'em all!</description> - <max-players>1</max-players> - <filters> - <filter name="puzzle"/> - </filters> - </channel> - - <channel name="admins"> - <description>Administrators' Lair</description> - <access-level>1</access-level> - <idle>true</idle> - </channel> - - </channels> - -</tetrinet-channels> Copied: jetrix/trunk/src/etc/conf/channels.xml (from rev 752, jetrix/trunk/src/etc/channels.xml) =================================================================== --- jetrix/trunk/src/etc/conf/channels.xml (rev 0) +++ jetrix/trunk/src/etc/conf/channels.xml 2008-09-02 17:48:20 UTC (rev 764) @@ -0,0 +1,282 @@ +<?xml version="1.0"?> +<!DOCTYPE tetrinet-channels PUBLIC "-//LFJR//Jetrix Channels//EN" "http://jetrix.sourceforge.net/dtd/tetrinet-channels.dtd"> + +<tetrinet-channels> + + <!-- Message Of The Day --> + <motd><![CDATA[ +<b> +Welcome on <b>Jetrix TetriNET Server</b>! +<u><blue>http://jetrix.sourceforge.net/</blue></u> +<b> + ]]></motd> + + <!-- Channel filters --> + <filter-definitions> + <alias name="flood" class="net.jetrix.filter.FloodFilter"/> + <alias name="start" class="net.jetrix.filter.StartFilter"/> + <alias name="amplifier" class="net.jetrix.filter.AmplifierFilter"/> + <alias name="ping" class="net.jetrix.filter.PingFilter"/> + <alias name="7tetris" class="net.jetrix.filter.TetrisFilter"/> + <alias name="stats" class="net.jetrix.filter.StatsFilter"/> + <alias name="logo" class="net.jetrix.filter.LogoFilter"/> + <alias name="sudden-death" class="net.jetrix.filter.SuddenDeathFilter"/> + <alias name="command" class="net.jetrix.filter.CommandFilter"/> + <alias name="survival" class="net.jetrix.filter.SurvivalFilter"/> + <alias name="puzzle" class="net.jetrix.filter.PuzzleFilter"/> + <alias name="random" class="net.jetrix.filter.RandomFilter"/> + </filter-definitions> + + <!-- Global filters --> + <default-filters> + <filter name="flood"> + <param name="capacity" value="8"/> + <param name="delay" value="5000"/> + </filter> + <filter name="start"> + <param name="delay" value="10000"/> + </filter> + <filter name="ping"/> + <filter name="stats"/> + <filter name="logo"/> + <filter name="sudden-death"/> + </default-filters> + + <!-- Winlists --> + <winlists> + <winlist name="default" class="net.jetrix.winlist.SimpleWinlist"> + <param name="display.score" value="true"/> + </winlist> + <winlist name="pure" class="net.jetrix.winlist.SimpleWinlist"> + <param name="display.score" value="true"/> + </winlist> + <winlist name="duel" class="net.jetrix.winlist.SimpleWinlist"> + <param name="display.score" value="true"/> + </winlist> + </winlists> + + <!-- Default game settings --> + <default-settings> + <!-- What level each player starts at --> + <starting-level>1</starting-level> + + <!-- How many lines to make before player level increases --> + <lines-per-level>2</lines-per-level> + + <!-- Number of levels to increase each time --> + <level-increase>1</level-increase> + + <!-- Lines to make to get a special block --> + <lines-per-special>2</lines-per-special> + + <!-- Number of special blocks added each time --> + <special-added>1</special-added> + + <!-- Capacity of Special block inventory --> + <special-capacity>18</special-capacity> + + <!-- Play by classic rules? --> + <classic-rules>true</classic-rules> + + <!-- Average together all player's game level? --> + <average-levels>true</average-levels> + + <!-- Same sequence of blocks for all players? (tetrinet 1.14 clients only) --> + <same-blocks>true</same-blocks> + + <block-occurancy> + <line>15</line> + <square>15</square> + <leftl>14</leftl> + <rightl>14</rightl> + <leftz>14</leftz> + <rightz>14</rightz> + <halfcross>14</halfcross> + </block-occurancy> + + <special-occurancy> + <addline>31</addline> + <clearline>21</clearline> + <nukefield>1</nukefield> + <randomclear>13</randomclear> + <switchfield>1</switchfield> + <clearspecial>14</clearspecial> + <gravity>1</gravity> + <quakefield>7</quakefield> + <blockbomb>11</blockbomb> + </special-occurancy> + + <!-- Sudden death parameters --> + <sudden-death> + <!-- Time in seconds before the sudden death begins, 0 to disable the sudden death --> + <time>600</time> + + <!-- The message displayed when the sudden death begins. Use "key:" prefix to display an internationalized message --> + <message>key:filter.suddendeath.message</message> + + <!-- The delay in seconds between lines additions --> + <delay>10</delay> + + <!-- The number of lines added --> + <lines-added>1</lines-added> + </sudden-death> + + </default-settings> + + + <channels> + <channel name="tetrinet1"> + <description>2:1</description> + <winlist name="default"/> + </channel> + + <channel name="tetrinet2"> + <description>2:1</description> + <winlist name="default"/> + </channel> + + <channel name="tetrinet3"> + <description>2:1</description> + <winlist name="default"/> + </channel> + + <channel name="pure"> + <description>Pure</description> + <winlist name="pure"/> + <settings> + <special-added>0</special-added> + </settings> + </channel> + + <channel name="pure2"> + <description>Pure</description> + <winlist name="pure"/> + <settings> + <special-added>0</special-added> + </settings> + </channel> + + <channel name="custom"> + <description>Custom mode</description> + <topic>Type /mode to change the settings</topic> + <filters> + <filter name="command"> + <param name="class" value="net.jetrix.commands.ModeCommand"/> + </filter> + </filters> + </channel> + + <channel name="random"> + <description>Random settings</description> + <topic>New game, new settings. Enjoy!</topic> + <filters> + <filter name="random"/> + </filters> + </channel> + + <channel name="duel1"> + <description>Duel 2:1</description> + <max-players>2</max-players> + <winlist name="duel"/> + </channel> + + <channel name="duel2"> + <description>Duel 2:1</description> + <max-players>2</max-players> + <winlist name="duel"/> + </channel> + + <channel name="pureduel"> + <description>Pure - No Specials</description> + <max-players>2</max-players> + <winlist name="default"/> + <settings> + <special-added>0</special-added> + <same-blocks>true</same-blocks> + </settings> + </channel> + + <channel name="sticks"> + <description>Sticks Only</description> + <settings> + <special-added>0</special-added> + <block-occurancy> + <line>100</line> + </block-occurancy> + </settings> + </channel> + + <channel name="SnS"> + <description><![CDATA[Sticks <i>and</i> Squares]]></description> + <settings> + <special-added>0</special-added> + <block-occurancy> + <line>50</line> + <square>50</square> + </block-occurancy> + </settings> + </channel> + + <channel name="7Tetris"> + <description>7 tetris to win!</description> + <topic> +<![CDATA[ +<b> +Welcome to the 7 tetris channel! The first player completing 7 tetris +win. There is no special in this game, and the lines are not added to +your opponents. Good luck! +<b> +]]> + </topic> + <settings> + <special-added>0</special-added> + </settings> + <filters> + <filter name="7tetris"/> + </filters> + </channel> + + <channel name="survival"> + <description>Staying Aliiiive !!</description> + <topic> +<![CDATA[ +<b> +Welcome to the survival channel! Drop as many blocks as you can +before you die. The sudden death is activated immediately and one +line is added every 5 seconds. +If you clear <b>2</b> lines, <b>1</b> extra line will be removed. +If you clear <b>3</b> lines, <b>2</b> extra lines will be removed. +If you clear <b>4</b> lines, <b>3</b> extra additional lines will be removed. +<b> +]]> + </topic> + <max-players>2</max-players> + <settings> + <sudden-death> + <time>5</time> + <delay>5</delay> + <lines-added>1</lines-added> + </sudden-death> + </settings> + <filters> + <filter name="survival"/> + </filters> + </channel> + + <channel name="puzzle"> + <description>Downstack 'em all!</description> + <max-players>1</max-players> + <filters> + <filter name="puzzle"/> + </filters> + </channel> + + <channel name="admins"> + <description>Administrators' Lair</description> + <access-level>1</access-level> + <idle>true</idle> + </channel> + + </channels> + +</tetrinet-channels> Property changes on: jetrix/trunk/src/etc/conf/channels.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Copied: jetrix/trunk/src/etc/conf/server.xml (from rev 752, jetrix/trunk/src/etc/server.xml) =================================================================== --- jetrix/trunk/src/etc/conf/server.xml (rev 0) +++ jetrix/trunk/src/etc/conf/server.xml 2008-09-02 17:48:20 UTC (rev 764) @@ -0,0 +1,122 @@ +<?xml version="1.0"?> +<!DOCTYPE tetrinet-server PUBLIC "-//LFJR//Jetrix TetriNET Server//EN" "http://jetrix.sourceforge.net/dtd/tetrinet-server.dtd"> + +<tetrinet-server host="[ALL]"> + + <!-- Server name --> + <name>Jetrix TetriNET Server</name> + + <!-- Server default language (using an ISO-639 two-letter language code) --> + <language>en</language> + + <!-- How many seconds of inactivity before timeout occurs --> + <timeout>1000</timeout> + + <!-- How many channels should be available on the server --> + <max-channels>8</max-channels> + + <!-- Maximum number of players on the server --> + <max-players>50</max-players> + + <!-- Maximum number of simultaneous connections allowed from the same IP --> + <max-connections>3</max-connections> + + <!-- Typing /op <thispassword> will give player operator status --> + <op-password>jetrixpass</op-password> + + <!-- Use this password to log on the administration console --> + <admin-password>adminpass</admin-password> + + <!-- Access Log, where requests are logged to --> + <access-log path="log/access%g.log" /> + + <!-- Error Log, where errors are logged to --> + <error-log path="log/error%g.log" /> + + <!-- Client listeners --> + <listeners> + <listener class="net.jetrix.listeners.TetrinetListener"/> + <listener class="net.jetrix.listeners.TSpecListener"/> + <listener class="net.jetrix.listeners.IRCListener" port="31456" auto-start="false"/> + <listener class="net.jetrix.listeners.HttpListener" port="8080"/> + </listeners> + + <!-- Services --> + <services> + <service class="net.jetrix.services.PublishingService"> + <!--<param name="host" value="tetrinet.yourhostname.net"/>--> + </service> + <service class="net.jetrix.services.GhostbusterService"/> + <service class="net.jetrix.services.VersionService"/> + </services> + + <!-- Server commands --> + <commands> + <command class="net.jetrix.commands.AwayCommand"/> + <command class="net.jetrix.commands.BroadcastCommand"/> + <command class="net.jetrix.commands.ConfigCommand"/> + <command class="net.jetrix.commands.EmoteCommand"/> + <command class="net.jetrix.commands.GotoCommand"/> + <command class="net.jetrix.commands.HelpCommand"/> + <command class="net.jetrix.commands.IgnoreCommand"/> + <command class="net.jetrix.commands.IpCommand"/> + <command class="net.jetrix.commands.JoinCommand"/> + <command class="net.jetrix.commands.KickCommand"/> + <command class="net.jetrix.commands.LanguageCommand"/> + <command class="net.jetrix.commands.ListCommand"/> + <command class="net.jetrix.commands.MotdCommand"/> + <command class="net.jetrix.commands.MoveCommand"/> + <command class="net.jetrix.commands.OperatorCommand"/> + <command class="net.jetrix.commands.PauseCommand"/> + <command class="net.jetrix.commands.PetitionCommand"/> + <command class="net.jetrix.commands.PingCommand"/> + <command class="net.jetrix.commands.RandomCommand"/> + <command class="net.jetrix.commands.ReplyCommand"/> + <command class="net.jetrix.commands.SpecListCommand"/> + <command class="net.jetrix.commands.StartCommand"/> + <command class="net.jetrix.commands.StopCommand"/> + <command class="net.jetrix.commands.SummonCommand"/> + <command class="net.jetrix.commands.TeamMessageCommand"/> + <command class="net.jetrix.commands.TeleportCommand"/> + <command class="net.jetrix.commands.TellCommand"/> + <command class="net.jetrix.commands.TimeCommand"/> + <command class="net.jetrix.commands.VersionCommand"/> + <command class="net.jetrix.commands.WhoCommand"/> + </commands> + + <ban> + <!-- Cheating from host 1cust007.tnt2.billgates.da.uu.net --> + <host>*.tnt*.billgates.da.uu.net</host> + + <!-- Flooding from 192.168.33.200. Ban all C class IP block --> + <host>192.168.33.*</host> + + <!-- Ban all hostname contain the word foobar --> + <host>*foobar*</host> + + <!-- Ban IP block from 192.168.10.0 to 192.168.19.255 --> + <host>192.168.1?.*</host> + + <!-- Ban nickname --> + <nick>billgates</nick> + + <!-- Ban team --> + <team>Flying Cucumbers</team> + </ban> + + <!-- Database connection parameters --> + <datasource> + <!-- The class of the JDBC driver used --> + <driver>com.mysql.jdbc.Driver</driver> + + <!-- The URL of the database (jdbc:<type>://<hostname>:<port>/<database>) --> + <url>jdbc:mysql://localhost/jetrix</url> + + <!-- The username connecting to the database --> + <username>jetrix</username> + + <!-- The password of the user --> + <password>jetrixpass</password> + </datasource> + +</tetrinet-server> Property changes on: jetrix/trunk/src/etc/conf/server.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: jetrix/trunk/src/etc/server.xml =================================================================== --- jetrix/trunk/src/etc/server.xml 2008-09-02 17:26:49 UTC (rev 763) +++ jetrix/trunk/src/etc/server.xml 2008-09-02 17:48:20 UTC (rev 764) @@ -1,122 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE tetrinet-server PUBLIC "-//LFJR//Jetrix TetriNET Server//EN" "http://jetrix.sourceforge.net/dtd/tetrinet-server.dtd"> - -<tetrinet-server host="[ALL]"> - - <!-- Server name --> - <name>Jetrix TetriNET Server</name> - - <!-- Server default language (using an ISO-639 two-letter language code) --> - <language>en</language> - - <!-- How many seconds of inactivity before timeout occurs --> - <timeout>1000</timeout> - - <!-- How many channels should be available on the server --> - <max-channels>8</max-channels> - - <!-- Maximum number of players on the server --> - <max-players>50</max-players> - - <!-- Maximum number of simultaneous connections allowed from the same IP --> - <max-connections>3</max-connections> - - <!-- Typing /op <thispassword> will give player operator status --> - <op-password>jetrixpass</op-password> - - <!-- Use this password to log on the administration console --> - <admin-password>adminpass</admin-password> - - <!-- Access Log, where requests are logged to --> - <access-log path="log/access%g.log" /> - - <!-- Error Log, where errors are logged to --> - <error-log path="log/error%g.log" /> - - <!-- Client listeners --> - <listeners> - <listener class="net.jetrix.listeners.TetrinetListener"/> - <listener class="net.jetrix.listeners.TSpecListener"/> - <listener class="net.jetrix.listeners.IRCListener" port="31456" auto-start="false"/> - <listener class="net.jetrix.listeners.HttpListener" port="8080"/> - </listeners> - - <!-- Services --> - <services> - <service class="net.jetrix.services.PublishingService"> - <!--<param name="host" value="tetrinet.yourhostname.net"/>--> - </service> - <service class="net.jetrix.services.GhostbusterService"/> - <service class="net.jetrix.services.VersionService"/> - </services> - - <!-- Server commands --> - <commands> - <command class="net.jetrix.commands.AwayCommand"/> - <command class="net.jetrix.commands.BroadcastCommand"/> - <command class="net.jetrix.commands.ConfigCommand"/> - <command class="net.jetrix.commands.EmoteCommand"/> - <command class="net.jetrix.commands.GotoCommand"/> - <command class="net.jetrix.commands.HelpCommand"/> - <command class="net.jetrix.commands.IgnoreCommand"/> - <command class="net.jetrix.commands.IpCommand"/> - <command class="net.jetrix.commands.JoinCommand"/> - <command class="net.jetrix.commands.KickCommand"/> - <command class="net.jetrix.commands.LanguageCommand"/> - <command class="net.jetrix.commands.ListCommand"/> - <command class="net.jetrix.commands.MotdCommand"/> - <command class="net.jetrix.commands.MoveCommand"/> - <command class="net.jetrix.commands.OperatorCommand"/> - <command class="net.jetrix.commands.PauseCommand"/> - <command class="net.jetrix.commands.PetitionCommand"/> - <command class="net.jetrix.commands.PingCommand"/> - <command class="net.jetrix.commands.RandomCommand"/> - <command class="net.jetrix.commands.ReplyCommand"/> - <command class="net.jetrix.commands.SpecListCommand"/> - <command class="net.jetrix.commands.StartCommand"/> - <command class="net.jetrix.commands.StopCommand"/> - <command class="net.jetrix.commands.SummonCommand"/> - <command class="net.jetrix.commands.TeamMessageCommand"/> - <command class="net.jetrix.commands.TeleportCommand"/> - <command class="net.jetrix.commands.TellCommand"/> - <command class="net.jetrix.commands.TimeCommand"/> - <command class="net.jetrix.commands.VersionCommand"/> - <command class="net.jetrix.commands.WhoCommand"/> - </commands> - - <ban> - <!-- Cheating from host 1cust007.tnt2.billgates.da.uu.net --> - <host>*.tnt*.billgates.da.uu.net</host> - - <!-- Flooding from 192.168.33.200. Ban all C class IP block --> - <host>192.168.33.*</host> - - <!-- Ban all hostname contain the word foobar --> - <host>*foobar*</host> - - <!-- Ban IP block from 192.168.10.0 to 192.168.19.255 --> - <host>192.168.1?.*</host> - - <!-- Ban nickname --> - <nick>billgates</nick> - - <!-- Ban team --> - <team>Flying Cucumbers</team> - </ban> - - <!-- Database connection parameters --> - <datasource> - <!-- The class of the JDBC driver used --> - <driver>com.mysql.jdbc.Driver</driver> - - <!-- The URL of the database (jdbc:<type>://<hostname>:<port>/<database>) --> - <url>jdbc:mysql://localhost/jetrix</url> - - <!-- The username connecting to the database --> - <username>jetrix</username> - - <!-- The password of the user --> - <password>jetrixpass</password> - </datasource> - -</tetrinet-server> Modified: jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2008-09-02 17:26:49 UTC (rev 763) +++ jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2008-09-02 17:48:20 UTC (rev 764) @@ -121,14 +121,14 @@ // parse the server configuration digester.push(this); - serverConfigURL = findResource("server.xml"); + serverConfigURL = findResource("conf/server.xml"); Reader reader = new InputStreamReader(serverConfigURL.openStream(), ENCODING); digester.parse(new InputSource(reader)); reader.close(); // parse the channel configuration digester.push(this); - channelsConfigURL = findResource("channels.xml"); + channelsConfigURL = findResource("conf/channels.xml"); reader = new InputStreamReader(channelsConfigURL.openStream(), ENCODING); digester.parse(new InputSource(reader)); reader.close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 17:26:55
|
Revision: 763 http://jetrix.svn.sourceforge.net/jetrix/?rev=763&view=rev Author: smanux Date: 2008-09-02 17:26:49 +0000 (Tue, 02 Sep 2008) Log Message: ----------- New shell script for Linux Modified Paths: -------------- jetrix/trunk/src/bin/jetrix Modified: jetrix/trunk/src/bin/jetrix =================================================================== --- jetrix/trunk/src/bin/jetrix 2008-09-02 16:47:44 UTC (rev 762) +++ jetrix/trunk/src/bin/jetrix 2008-09-02 17:26:49 UTC (rev 763) @@ -1,5 +1,46 @@ #!/bin/sh +# ----------------------------------------------------------------------------- +# Start/Stop Script for the Jetrix Tetrinet Server +# (derived from the catalina.sh script for Tomcat) +# +# Environment Variable Prequisites +# +# JETRIX_HOME May point at your Jetrix installation directory. +# +# JAVA_HOME Must point at your Java Development Kit installation. +# Required to run the with the "debug" or "javac" argument. +# +# JAVA_OPTS (Optional) Java runtime options used when the "start", +# "stop", or "run" command is executed. +# +# JETRIX_PID (Optional) Path of the file which should contains the pid +# of Jetrix startup java process, when start (fork) is used +# +# $Id$ +# ----------------------------------------------------------------------------- +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +# Get standard environment variables +PRGDIR=`dirname "$PRG"` + +# Only set JETRIX_HOME if not already set +[ -z "$JETRIX_HOME" ] && JETRIX_HOME=`cd "$PRGDIR" ; pwd` + +cd $JETRIX_HOME + + if [ -n "$JAVA_HOME" ] then JAVA_PATH="$JAVA_HOME/bin/java"; @@ -7,4 +48,56 @@ JAVA_PATH="java"; fi -$JAVA_PATH -jar lib/jetrix-launcher-@version@.jar $1 +EXECUTABLE_JAR="$JETRIX_HOME/lib/jetrix-launcher-@version@.jar" + +# ----- Execute The Requested Command ----------------------------------------- + +echo "Using JETRIX_HOME: $JETRIX_HOME" +echo "Using JAVA_PATH: $JAVA_PATH" + +if [ "$1" = "run" ]; then + echo "Running Jetrix..." + shift + exec "$JAVA_PATH" $JAVA_OPTS -jar $EXECUTABLE_JAR start + +elif [ "$1" = "start" ] ; then + echo "Starting Jetrix..." + shift + "$JAVA_PATH" $JAVA_OPTS -jar $EXECUTABLE_JAR start \ + >> "$JETRIX_HOME"/log/jetrix.out 2>&1 & + + if [ ! -z "$JETRIX_PID" ]; then + echo $! > $JETRIX_PID + fi + +elif [ "$1" = "stop" ] ; then + echo "Stopping Jetrix..." + shift + FORCE=0 + if [ "$1" = "-force" ]; then + shift + FORCE=1 + fi + + "$JAVA_PATH" $JAVA_OPTS -jar $EXECUTABLE_JAR stop + + if [ $FORCE -eq 1 ]; then + if [ ! -z "$JETRIX_PID" ]; then + echo "Killing: `cat $JETRIX_PID`" + kill -9 `cat $JETRIX_PID` + else + echo "Kill failed: \$JETRIX_PID not set" + fi + fi + +else + + echo "Usage: jetrix.sh ( commands ... )" + echo "commands:" + echo " run Start Jetrix in the current window" + echo " start Start Jetrix in a separate window" + echo " stop Stop Jetrix" + echo " stop -force Stop Jetrix (followed by kill -KILL)" + exit 1 + +fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 16:47:52
|
Revision: 762 http://jetrix.svn.sourceforge.net/jetrix/?rev=762&view=rev Author: smanux Date: 2008-09-02 16:47:44 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Fixed line feeds in maintainer scripts Modified Paths: -------------- jetrix/trunk/src/etc/control/postrm Property Changed: ---------------- jetrix/trunk/src/etc/control/control jetrix/trunk/src/etc/control/postinst jetrix/trunk/src/etc/control/postrm jetrix/trunk/src/etc/control/preinst Property changes on: jetrix/trunk/src/etc/control/control ___________________________________________________________________ Added: svn:eol-style + LF Property changes on: jetrix/trunk/src/etc/control/postinst ___________________________________________________________________ Added: svn:eol-style + LF Modified: jetrix/trunk/src/etc/control/postrm =================================================================== --- jetrix/trunk/src/etc/control/postrm 2008-09-02 15:20:37 UTC (rev 761) +++ jetrix/trunk/src/etc/control/postrm 2008-09-02 16:47:44 UTC (rev 762) @@ -1,3 +1,3 @@ -#!/bin/sh - -rm /usr/bin/jetrix +#!/bin/sh + +rm -f /usr/bin/jetrix Property changes on: jetrix/trunk/src/etc/control/postrm ___________________________________________________________________ Added: svn:eol-style + LF Property changes on: jetrix/trunk/src/etc/control/preinst ___________________________________________________________________ Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 15:20:42
|
Revision: 761 http://jetrix.svn.sourceforge.net/jetrix/?rev=761&view=rev Author: smanux Date: 2008-09-02 15:20:37 +0000 (Tue, 02 Sep 2008) Log Message: ----------- NSIS fix on Linux Modified Paths: -------------- jetrix/trunk/src/bin/launcher.nsi Modified: jetrix/trunk/src/bin/launcher.nsi =================================================================== --- jetrix/trunk/src/bin/launcher.nsi 2008-09-02 15:15:27 UTC (rev 760) +++ jetrix/trunk/src/bin/launcher.nsi 2008-09-02 15:20:37 UTC (rev 761) @@ -7,11 +7,12 @@ ; ;------------------------------------------------------------------------------- +SetCompressor lzma + Name "Jetrix TetriNET Server" Caption "Jetrix TetriNET Server" Icon "jetrix.ico" OutFile "jetrix.exe" -SetCompressor lzma SilentInstall silent AutoCloseWindow true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 15:15:37
|
Revision: 760 http://jetrix.svn.sourceforge.net/jetrix/?rev=760&view=rev Author: smanux Date: 2008-09-02 15:15:27 +0000 (Tue, 02 Sep 2008) Log Message: ----------- The Windows installer is now buildable on Linux Slight improvement of the Windows installer compression Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/src/bin/installer.nsi jetrix/trunk/src/bin/launcher.nsi Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-09-02 13:51:51 UTC (rev 759) +++ jetrix/trunk/build.xml 2008-09-02 15:15:27 UTC (rev 760) @@ -270,7 +270,7 @@ <target name="dist.win" depends="deploy" description="Build the Windows installer"> <taskdef name="nsis" classname="net.sf.nsisant.Task" classpath="lib/nsisant-1.2.jar"/> - <condition property="nsis.home" value="C:\Program Files\NSIS"> + <condition property="nsis.home" value="C:\Program Files\NSIS" else="/usr/bin"> <os family="windows"/> </condition> Modified: jetrix/trunk/src/bin/installer.nsi =================================================================== --- jetrix/trunk/src/bin/installer.nsi 2008-09-02 13:51:51 UTC (rev 759) +++ jetrix/trunk/src/bin/installer.nsi 2008-09-02 15:15:27 UTC (rev 760) @@ -10,7 +10,7 @@ !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define BASE_PATH "..\.." -SetCompressor lzma +SetCompressor /SOLID lzma ; MUI 1.67 compatible ------ !include "MUI.nsh" Modified: jetrix/trunk/src/bin/launcher.nsi =================================================================== --- jetrix/trunk/src/bin/launcher.nsi 2008-09-02 13:51:51 UTC (rev 759) +++ jetrix/trunk/src/bin/launcher.nsi 2008-09-02 15:15:27 UTC (rev 760) @@ -11,6 +11,7 @@ Caption "Jetrix TetriNET Server" Icon "jetrix.ico" OutFile "jetrix.exe" +SetCompressor lzma SilentInstall silent AutoCloseWindow true @@ -68,6 +69,7 @@ JreFound: Pop $R1 + MessageBox MB_ICONEXCLAMATION|MB_YESNO 'exec: $R0' IDNO +2 Exch $R0 FunctionEnd This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 13:51:53
|
Revision: 759 http://jetrix.svn.sourceforge.net/jetrix/?rev=759&view=rev Author: smanux Date: 2008-09-02 13:51:51 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Use the NSIS Ant task to build the Windows installer Modified Paths: -------------- jetrix/trunk/build.xml Added Paths: ----------- jetrix/trunk/lib/nsisant-1.2.jar Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-09-02 10:49:12 UTC (rev 758) +++ jetrix/trunk/build.xml 2008-09-02 13:51:51 UTC (rev 759) @@ -269,6 +269,11 @@ <target name="dist.win" depends="deploy" description="Build the Windows installer"> + <taskdef name="nsis" classname="net.sf.nsisant.Task" classpath="lib/nsisant-1.2.jar"/> + <condition property="nsis.home" value="C:\Program Files\NSIS"> + <os family="windows"/> + </condition> + <!-- Build the windows executable file jetrix.exe --> <mkdir dir="${build}/bin"/> <copy todir="${build}/bin" filtering="true"> @@ -276,14 +281,14 @@ </copy> <copy file="${src}/etc/icons/jetrix.ico" todir="${build}/bin"/> - <exec executable="C:\Program Files\NSIS\makensis.exe"> - <arg line="${build}/bin/launcher.nsi"/> - </exec> + <nsis verbosity="3" script="${build}/bin/launcher.nsi" path="${nsis.home}"> + <define name="OUT_DIR" value="${build}/bin"/> + </nsis> <!-- Build the installer --> - <exec executable="C:\Program Files\NSIS\makensis.exe"> - <arg line="${build}/bin/installer.nsi"/> - </exec> + <nsis verbosity="3" script="${build}/bin/installer.nsi" path="${nsis.home}"> + <define name="OUT_DIR" value="${build}/bin"/> + </nsis> <move file="${build}/bin/jetrix-${version}-installer.exe" todir="${dist}/bin"/> </target> Property changes on: jetrix/trunk/lib/nsisant-1.2.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 10:49:14
|
Revision: 758 http://jetrix.svn.sourceforge.net/jetrix/?rev=758&view=rev Author: smanux Date: 2008-09-02 10:49:12 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Added the missing directory entries in the tar file Modified Paths: -------------- jetrix/trunk/build.xml Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-09-02 09:49:34 UTC (rev 757) +++ jetrix/trunk/build.xml 2008-09-02 10:49:12 UTC (rev 758) @@ -194,20 +194,13 @@ <include name="jetrix" /> <include name="update" /> </zipfileset> + <zipfileset prefix="jetrix-${version}/lib" dir="${build}/lib"> + <include name="*.pack" /> + </zipfileset> <zipfileset prefix="jetrix-${version}/lib/" dir="${dist}/lib/"> <include name="jetrix-${version}.jar.pack" /> <include name="jetrix-launcher-${version}.jar" /> </zipfileset> - <zipfileset prefix="jetrix-${version}/lib/" dir="${build}/lib"> - <include name="commons-digester*.pack" /> - <include name="commons-collections*.pack" /> - <include name="commons-beanutils*.pack" /> - <include name="commons-lang*.pack" /> - <include name="jetty*.pack"/> - <include name="servlet-light*.pack"/> - <include name="jasper-runtime*.pack"/> - <include name="jcrontab*.pack"/> - </zipfileset> <zipfileset prefix="jetrix-${version}/lib/" dir="${dist}/webapp/"> <include name="*.war.pack" /> </zipfileset> @@ -234,26 +227,22 @@ <include name="jetrix" /> <include name="update" /> </tarfileset> + <tarfileset prefix="jetrix-${version}" dir="${build}" includes="lib"/> + <tarfileset prefix="jetrix-${version}/lib" dir="${build}/lib"> + <include name="*.pack" /> + </tarfileset> <tarfileset prefix="jetrix-${version}/lib/" dir="${dist}/lib/"> <include name="jetrix-${version}.jar.pack" /> <include name="jetrix-launcher-${version}.jar" /> </tarfileset> - <tarfileset prefix="jetrix-${version}/lib/" dir="${build}/lib"> - <include name="commons-digester*.pack" /> - <include name="commons-collections*.pack" /> - <include name="commons-beanutils*.pack" /> - <include name="commons-lang*.pack" /> - <include name="jetty*.pack"/> - <include name="servlet-light*.pack"/> - <include name="jasper-runtime*.pack"/> - <include name="jcrontab*.pack"/> - </tarfileset> <tarfileset prefix="jetrix-${version}/lib/" dir="${dist}/webapp/"> <include name="*.war.pack" /> </tarfileset> + <tarfileset prefix="jetrix-${version}" dir="${src}" includes="lang"/> <tarfileset prefix="jetrix-${version}/lang/" dir="${src}/lang/"> <include name="*.properties" /> </tarfileset> + <tarfileset prefix="jetrix-${version}" dir="${src}/etc" includes="log"/> <tarfileset prefix="jetrix-${version}/log/" dir="${src}/etc/log/"/> </tar> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 09:49:37
|
Revision: 757 http://jetrix.svn.sourceforge.net/jetrix/?rev=757&view=rev Author: smanux Date: 2008-09-02 09:49:34 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Jetrix can now be stopped from the command line with "jetrix stop" Modified Paths: -------------- jetrix/trunk/src/bin/jetrix jetrix/trunk/src/bin/jetrix.bat jetrix/trunk/src/java/net/jetrix/Launcher.java jetrix/trunk/src/java/net/jetrix/Server.java Added Paths: ----------- jetrix/trunk/src/java/net/jetrix/listeners/ShutdownListener.java Removed Paths: ------------- jetrix/trunk/src/etc/log/.cvsignore Modified: jetrix/trunk/src/bin/jetrix =================================================================== --- jetrix/trunk/src/bin/jetrix 2008-09-02 09:45:45 UTC (rev 756) +++ jetrix/trunk/src/bin/jetrix 2008-09-02 09:49:34 UTC (rev 757) @@ -7,4 +7,4 @@ JAVA_PATH="java"; fi -$JAVA_PATH -jar lib/jetrix-launcher-@version@.jar +$JAVA_PATH -jar lib/jetrix-launcher-@version@.jar $1 Modified: jetrix/trunk/src/bin/jetrix.bat =================================================================== --- jetrix/trunk/src/bin/jetrix.bat 2008-09-02 09:45:45 UTC (rev 756) +++ jetrix/trunk/src/bin/jetrix.bat 2008-09-02 09:49:34 UTC (rev 757) @@ -5,4 +5,4 @@ IF NOT JAVA_HOME == "" SET JAVA_EXE="%JAVA_HOME%\bin\java" IF JAVA_HOME == "" SET JAVA_EXE=java -%JAVA_EXE% -Djava.library.path=lib -jar lib/jetrix-launcher-@version@.jar +%JAVA_EXE% -Djava.library.path=lib -jar lib/jetrix-launcher-@version@.jar %1 Deleted: jetrix/trunk/src/etc/log/.cvsignore =================================================================== --- jetrix/trunk/src/etc/log/.cvsignore 2008-09-02 09:45:45 UTC (rev 756) +++ jetrix/trunk/src/etc/log/.cvsignore 2008-09-02 09:49:34 UTC (rev 757) @@ -1 +0,0 @@ -*.log Modified: jetrix/trunk/src/java/net/jetrix/Launcher.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Launcher.java 2008-09-02 09:45:45 UTC (rev 756) +++ jetrix/trunk/src/java/net/jetrix/Launcher.java 2008-09-02 09:49:34 UTC (rev 757) @@ -21,11 +21,16 @@ import java.io.File; import java.io.FileOutputStream; -import java.util.List; -import java.util.ArrayList; +import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; -import java.util.jar.*; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.List; +import java.util.jar.JarOutputStream; +import java.util.jar.Pack200; /** * An application launcher executing a specified class and building dynamically @@ -46,11 +51,42 @@ */ public static void main(String[] args) throws Exception { + if (args.length == 1 && "stop".equals(args[0])) + { + stop(); + } + else + { + start(args); + } + } + + private static void start(String[] args) throws Exception + { // get the files in the lib directory File repository = new File("lib/"); - File[] files = repository.listFiles(); // decompress the pack200 files + unpack(repository); + + ClassLoader loader = createClassLoader(repository, new File("lang/")); + + Thread.currentThread().setContextClassLoader(loader); + + // run the main method of the specified class + Class serverClass = loader.loadClass(MAIN_CLASS); + serverClass.getMethod("main", String[].class).invoke(null, new Object[] { args }); + } + + /** + * Unpack the pack200 files in the specified directory + * + * @param directory + */ + private static void unpack(File directory) throws IOException + { + File[] files = directory.listFiles(); + for (File file : files) { String filename = file.getAbsolutePath(); @@ -69,40 +105,57 @@ file.delete(); } } + } - // build the list of JARs in the ./lib directory - files = repository.listFiles(); - List<URL> jars = new ArrayList<URL>(); + /** + * Build a classloader including the jar and zip files in the specified + * directories. The directories are also included in the classpath. + * + * @param directories + */ + private static ClassLoader createClassLoader(File... directories) throws Exception + { + List<URL> urls = new ArrayList<URL>(); - for (int i = 0; i < files.length; i++) + for (File directory : directories) { - String filename = files[i].getAbsolutePath(); - if (filename.endsWith(".jar") || filename.endsWith(".zip")) + // add the jar and zip files in the directory to the classpath + File[] files = directory.listFiles(); + + for (int i = 0; i < files.length; i++) { - jars.add(files[i].toURL()); + String filename = files[i].getAbsolutePath(); + if (filename.endsWith(".jar") || filename.endsWith(".zip")) + { + urls.add(files[i].toURI().toURL()); + } } + + // add the directory to the classpath + urls.add(directory.toURI().toURL()); } - // add the lib directory to the classpath - jars.add(repository.toURL()); + // create the classloader + return new URLClassLoader(urls.toArray(new URL[urls.size()]), null); + } - // add the lang directory to the classpath - jars.add(new File("lang/").toURL()); + private static void stop() throws Exception + { + // send the "shutdown" to the UDP port 31457 + byte[] msg = "shutdown".getBytes("UTF8"); + DatagramPacket packet = new DatagramPacket(msg, msg.length); + packet.setAddress(InetAddress.getLocalHost()); + packet.setPort(31457); - // build the list of URLs - URL[] urls = new URL[jars.size()]; - for (int i = 0; i < jars.size(); i++) + DatagramSocket socket = new DatagramSocket(); + try { - urls[i] = jars.get(i); + socket.send(packet); } - - // create the classloader - ClassLoader loader = new URLClassLoader(urls, null); - Thread.currentThread().setContextClassLoader(loader); - - // run the main method of the specified class - Class serverClass = loader.loadClass(MAIN_CLASS); - serverClass.getMethod("main", args.getClass()).invoke(null, new Object[] { args }); + finally + { + socket.close(); + } } } Modified: jetrix/trunk/src/java/net/jetrix/Server.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Server.java 2008-09-02 09:45:45 UTC (rev 756) +++ jetrix/trunk/src/java/net/jetrix/Server.java 2008-09-02 09:49:34 UTC (rev 757) @@ -27,6 +27,7 @@ import net.jetrix.config.*; import net.jetrix.messages.*; import net.jetrix.services.VersionService; +import net.jetrix.listeners.ShutdownListener; /** * Main class, starts server components. @@ -111,6 +112,9 @@ } } + // start the shutdown listener + new ShutdownListener().start(); + // start the services for (Service service : config.getServices()) { @@ -281,7 +285,7 @@ */ public static void main(String[] args) { - System.out.println("Jetrix TetriNET Server " + ServerConfig.VERSION + ", Copyright (C) 2001-2005 Emmanuel Bourg\n"); + System.out.println("Jetrix TetriNET Server " + ServerConfig.VERSION + ", Copyright (C) 2001-2008 Emmanuel Bourg\n"); Server server = Server.getInstance(); server.start(); } Added: jetrix/trunk/src/java/net/jetrix/listeners/ShutdownListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/ShutdownListener.java (rev 0) +++ jetrix/trunk/src/java/net/jetrix/listeners/ShutdownListener.java 2008-09-02 09:49:34 UTC (rev 757) @@ -0,0 +1,99 @@ +/** + * 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.listeners; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.util.logging.Level; + +import net.jetrix.Listener; +import net.jetrix.Server; +import net.jetrix.services.AbstractService; + +/** + * Listens for shutdown commands from the localhost. This is used to stop + * the server from the shell on Unix. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ShutdownListener extends AbstractService implements Listener +{ + private static final String SHUTDOWN_COMMAND = "shutdown"; + + public String getName() + { + return "shutdown"; + } + + public int getPort() + { + return 31457; + } + + public void setPort(int port) + { + } + + public void start() + { + Thread t = new Thread(this, "listener: " + getName()); + t.setDaemon(true); + t.start(); + } + + public void stop() + { + } + + public void run() + { + try + { + DatagramSocket socket = new DatagramSocket(new InetSocketAddress(InetAddress.getLocalHost(), getPort())); + + while (true) + { + int length = SHUTDOWN_COMMAND.length(); + DatagramPacket packet = new DatagramPacket(new byte[length], length); + socket.receive(packet); + + if (packet != null && new String(packet.getData(), "UTF8").equals(SHUTDOWN_COMMAND)) + { + log.info("Shutdown command received"); + Server.getInstance().stop(); + break; + } + } + } + catch (IOException e) + { + log.log(Level.WARNING, "ShutdownListener error", e); + } + } + + public boolean isRunning() + { + return true; + } +} Property changes on: jetrix/trunk/src/java/net/jetrix/listeners/ShutdownListener.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-09-02 09:45:48
|
Revision: 756 http://jetrix.svn.sourceforge.net/jetrix/?rev=756&view=rev Author: smanux Date: 2008-09-02 09:45:45 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Added a symbolic link in /usr/bin to start Jetrix Modified Paths: -------------- jetrix/trunk/src/etc/control/control jetrix/trunk/src/etc/control/postinst Added Paths: ----------- jetrix/trunk/src/etc/control/postrm Modified: jetrix/trunk/src/etc/control/control =================================================================== --- jetrix/trunk/src/etc/control/control 2008-09-02 07:28:18 UTC (rev 755) +++ jetrix/trunk/src/etc/control/control 2008-09-02 09:45:45 UTC (rev 756) @@ -4,6 +4,11 @@ Priority: optional Architecture: all Depends: sun-java6-jre +Suggest: gtetrinet Maintainer: Emmanuel Bourg <sm...@lf...> Homepage: http://jetrix.sourceforge.net Description: Jetrix TetriNET Server + Jetrix is a server hosting TetriNET games. TetriNET is a variant of + Tetris played over the internet and confronting up to six players + simultaneously. Jetrix features a web based admnistration console to + tune easily the settings of the server. Modified: jetrix/trunk/src/etc/control/postinst =================================================================== --- jetrix/trunk/src/etc/control/postinst 2008-09-02 07:28:18 UTC (rev 755) +++ jetrix/trunk/src/etc/control/postinst 2008-09-02 09:45:45 UTC (rev 756) @@ -1,3 +1,5 @@ #!/bin/sh +ln -s /usr/share/jetrix/jetrix /usr/bin/jetrix + # TODO Move the log directory and create a symlink Added: jetrix/trunk/src/etc/control/postrm =================================================================== --- jetrix/trunk/src/etc/control/postrm (rev 0) +++ jetrix/trunk/src/etc/control/postrm 2008-09-02 09:45:45 UTC (rev 756) @@ -0,0 +1,3 @@ +#!/bin/sh + +rm /usr/bin/jetrix This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 07:28:23
|
Revision: 755 http://jetrix.svn.sourceforge.net/jetrix/?rev=755&view=rev Author: smanux Date: 2008-09-02 07:28:18 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Improved error reporting Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/LogManager.java jetrix/trunk/src/java/net/jetrix/winlist/SimpleWinlist.java jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java jetrix/trunk/src/java/net/jetrix/winlist/WinlistManager.java Modified: jetrix/trunk/src/java/net/jetrix/LogManager.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/LogManager.java 2008-09-02 07:26:19 UTC (rev 754) +++ jetrix/trunk/src/java/net/jetrix/LogManager.java 2008-09-02 07:28:18 UTC (rev 755) @@ -71,7 +71,7 @@ } catch (IOException e) { - log.log(Level.WARNING, e.getMessage(), e); + log.log(Level.WARNING, "Unable to configure the logger", e); } } Modified: jetrix/trunk/src/java/net/jetrix/winlist/SimpleWinlist.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/winlist/SimpleWinlist.java 2008-09-02 07:26:19 UTC (rev 754) +++ jetrix/trunk/src/java/net/jetrix/winlist/SimpleWinlist.java 2008-09-02 07:28:18 UTC (rev 755) @@ -248,21 +248,11 @@ } catch (Exception e) { - log.log(Level.WARNING, e.getMessage(), e); + log.log(Level.WARNING, "Unable to read the winlist file " + file, e); } finally { - try - { - if (reader != null) - { - reader.close(); - } - } - catch (Exception e) - { - log.log(Level.WARNING, e.getMessage(), e); - } + close(reader); } } } @@ -278,9 +268,10 @@ if (id != null) { BufferedWriter writer = null; + File file = new File(id + ".winlist"); try { - writer = new BufferedWriter(new FileWriter(id + ".winlist")); + writer = new BufferedWriter(new FileWriter(file)); for (Score score : scores) { @@ -297,21 +288,11 @@ } catch (Exception e) { - log.log(Level.WARNING, e.getMessage(), e); + log.log(Level.WARNING, "Unable to write the winlist file " + file, e); } finally { - try - { - if (writer != null) - { - writer.close(); - } - } - catch (Exception e) - { - log.log(Level.WARNING, e.getMessage(), e); - } + close(writer); } } } @@ -338,4 +319,21 @@ return message; } + /** + * Close quietly the specified stream or reader. + */ + void close(Closeable closeable) + { + if (closeable != null) + { + try + { + closeable.close(); + } + catch (IOException e) + { + } + } + } + } Modified: jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java 2008-09-02 07:26:19 UTC (rev 754) +++ jetrix/trunk/src/java/net/jetrix/winlist/TetrixWinlist.java 2008-09-02 07:28:18 UTC (rev 755) @@ -55,9 +55,11 @@ if (file.exists()) { + InputStream in = null; + try { - InputStream in = new BufferedInputStream(new FileInputStream(file)); + in = new BufferedInputStream(new FileInputStream(file)); scoreCount = Math.max(scoreCount, file.length() / STRUCT_SIZE); byte[] struct = new byte[STRUCT_SIZE]; @@ -68,13 +70,15 @@ if (score == null) break; scores.add(score); } - - in.close(); } catch (IOException e) { - log.log(Level.WARNING, e.getMessage(), e); + log.log(Level.WARNING, "Unable to read the winlist file " + file, e); } + finally + { + close(in); + } } initialized = true; @@ -83,10 +87,11 @@ protected void save() { File file = new File(filename); + OutputStream out = null; try { - OutputStream out = new BufferedOutputStream(new FileOutputStream(file)); + out = new BufferedOutputStream(new FileOutputStream(file)); for (int i = 0; i < scoreCount; i++) { @@ -101,12 +106,15 @@ } out.flush(); - out.close(); } catch (IOException e) { - log.log(Level.WARNING, e.getMessage(), e); + log.log(Level.WARNING, "Unable to write the winlist file " + file, e); } + finally + { + close(out); + } } /** Modified: jetrix/trunk/src/java/net/jetrix/winlist/WinlistManager.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/winlist/WinlistManager.java 2008-09-02 07:26:19 UTC (rev 754) +++ jetrix/trunk/src/java/net/jetrix/winlist/WinlistManager.java 2008-09-02 07:28:18 UTC (rev 755) @@ -80,7 +80,7 @@ } catch (Exception e) { - log.log(Level.WARNING, e.getMessage(), e); + log.log(Level.WARNING, "Unable to create the winlist '" + config.getName() + "'", e); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 07:26:23
|
Revision: 754 http://jetrix.svn.sourceforge.net/jetrix/?rev=754&view=rev Author: smanux Date: 2008-09-02 07:26:19 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Generified ScoreComparator Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/winlist/ScoreComparator.java Modified: jetrix/trunk/src/java/net/jetrix/winlist/ScoreComparator.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/winlist/ScoreComparator.java 2008-09-02 06:38:53 UTC (rev 753) +++ jetrix/trunk/src/java/net/jetrix/winlist/ScoreComparator.java 2008-09-02 07:26:19 UTC (rev 754) @@ -19,7 +19,7 @@ package net.jetrix.winlist; -import java.util.*; +import java.util.Comparator; /** * A {@link java.util.Comparator} for the winlist scores. Scores are sorted in @@ -28,12 +28,10 @@ * @author Emmanuel Bourg * @version $Revision$, $Date$ */ -public class ScoreComparator implements Comparator +public class ScoreComparator implements Comparator<Score> { - public int compare(Object o1, Object o2) + public int compare(Score score1, Score score2) { - Score score1 = (Score) o1; - Score score2 = (Score) o2; return (int) (score2.getScore() - score1.getScore()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-02 06:38:57
|
Revision: 753 http://jetrix.svn.sourceforge.net/jetrix/?rev=753&view=rev Author: smanux Date: 2008-09-02 06:38:53 +0000 (Tue, 02 Sep 2008) Log Message: ----------- Expected exceptions when the server is shutting down are no longer logged Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java Modified: jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2008-09-01 22:00:25 UTC (rev 752) +++ jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2008-09-02 06:38:53 UTC (rev 753) @@ -151,14 +151,20 @@ } catch (IOException e) { - log.log(Level.SEVERE, e.getMessage(), e); + if (Server.getInstance().getConfig().isRunning()) + { + log.log(Level.SEVERE, "Connexion error with the tetrinet client '" + getUser().getName() + "'", e); + } } finally { - disconnect(); - try { in.close(); } catch (IOException e) { e.printStackTrace(); } - try { out.close(); } catch (IOException e) { e.printStackTrace(); } - try { socket.close(); } catch (IOException e) { e.printStackTrace(); } + if (!socket.isClosed()) + { + disconnect(); + try { in.close(); } catch (IOException e) { e.printStackTrace(); } + try { out.close(); } catch (IOException e) { e.printStackTrace(); } + try { socket.close(); } catch (IOException e) { e.printStackTrace(); } + } // unregister the client from the server ClientRepository.getInstance().removeClient(this); Modified: jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2008-09-01 22:00:25 UTC (rev 752) +++ jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2008-09-02 06:38:53 UTC (rev 753) @@ -117,7 +117,11 @@ { ioe.printStackTrace(); } - e.printStackTrace(); + + if (Server.getInstance().getConfig().isRunning()) + { + e.printStackTrace(); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-09-01 22:00:27
|
Revision: 752 http://jetrix.svn.sourceforge.net/jetrix/?rev=752&view=rev Author: smanux Date: 2008-09-01 22:00:25 +0000 (Mon, 01 Sep 2008) Log Message: ----------- Fixed the double click on the tray icon Improved the tray icon on Linux System tray links can now be opened on Linux and OS X Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/src/java/net/jetrix/SystrayManager.java Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-08-28 08:20:33 UTC (rev 751) +++ jetrix/trunk/build.xml 2008-09-01 22:00:25 UTC (rev 752) @@ -107,6 +107,7 @@ </fileset> <fileset dir="${src}/etc/icons"> <include name="jetrix-16x16.png"/> + <include name="jetrix-32x32.png"/> </fileset> </jar> Modified: jetrix/trunk/src/java/net/jetrix/SystrayManager.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/SystrayManager.java 2008-08-28 08:20:33 UTC (rev 751) +++ jetrix/trunk/src/java/net/jetrix/SystrayManager.java 2008-09-01 22:00:25 UTC (rev 752) @@ -19,19 +19,16 @@ package net.jetrix; -import java.awt.AWTException; -import java.awt.Font; -import java.awt.Image; -import java.awt.MenuItem; -import java.awt.PopupMenu; -import java.awt.SystemTray; -import java.awt.TrayIcon; +import java.awt.*; +import java.awt.image.ImageObserver; +import java.awt.image.ImageProducer; +import java.awt.image.BufferedImage; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; -import javax.swing.ImageIcon; +import javax.swing.*; import net.jetrix.config.ServerConfig; import net.jetrix.listeners.HttpListener; @@ -108,23 +105,18 @@ menu.setFont(font); // build the trayIcon icon - Image icon = new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("jetrix-16x16.png")).getImage(); + String osname = System.getProperty("os.name"); + String iconname = osname.contains("Linux") ? "jetrix-32x32.png" : "jetrix-16x16.png"; + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + Image icon = new ImageIcon(loader.getResource(iconname)).getImage(); trayIcon = new TrayIcon(icon, TITLE, menu); trayIcon.setImageAutoSize(true); trayIcon.addActionListener(new ActionListener() { - private long timestamp; - public void actionPerformed(ActionEvent e) { - // emulates a double click listener - if (e.getWhen() - timestamp < 750) - { - openWebAdmin(); - } - - timestamp = e.getWhen(); + openWebAdmin(); } }); @@ -198,7 +190,19 @@ try { // open the browser - Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + String osname = System.getProperty("os.name"); + if (osname.contains("Linux")) + { + Runtime.getRuntime().exec("firefox " + url); + } + else if (osname.contains("Windows")) + { + Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); + } + else if (osname.contains("Mac")) + { + Runtime.getRuntime().exec("open " + url); + } } catch (IOException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-28 08:20:38
|
Revision: 751 http://jetrix.svn.sourceforge.net/jetrix/?rev=751&view=rev Author: smanux Date: 2008-08-28 08:20:33 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Initial import Added Paths: ----------- webspec/trunk/LICENSE.txt webspec/trunk/pom.xml webspec/trunk/src/ webspec/trunk/src/main/ webspec/trunk/src/main/java/ webspec/trunk/src/main/java/net/ webspec/trunk/src/main/java/net/jetrix/ webspec/trunk/src/main/java/net/jetrix/spectator/ webspec/trunk/src/main/java/net/jetrix/spectator/PlayerResolver.java webspec/trunk/src/main/java/net/jetrix/spectator/Spectator.java webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorAgent.java webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorApplet.java webspec/trunk/src/main/java/net/jetrix/spectator/ui/ webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChannelMenu.java webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChatPanel.java webspec/trunk/src/main/java/net/jetrix/spectator/ui/FieldComponent.java webspec/trunk/src/main/java/net/jetrix/spectator/ui/GameEventsPanel.java webspec/trunk/src/main/java/net/jetrix/spectator/ui/SpectatorFrame.java webspec/trunk/src/main/java/net/jetrix/spectator/ui/SpectatorPanel.java webspec/trunk/src/main/java/net/jetrix/spectator/ui/TetrinetColor.java webspec/trunk/src/main/resources/ webspec/trunk/src/main/resources/images/ webspec/trunk/src/main/resources/images/0.png webspec/trunk/src/main/resources/images/1.png webspec/trunk/src/main/resources/images/2.png webspec/trunk/src/main/resources/images/3.png webspec/trunk/src/main/resources/images/4.png webspec/trunk/src/main/resources/images/5.png webspec/trunk/src/main/resources/images/a.png webspec/trunk/src/main/resources/images/b.png webspec/trunk/src/main/resources/images/background.png webspec/trunk/src/main/resources/images/c.png webspec/trunk/src/main/resources/images/g.png webspec/trunk/src/main/resources/images/n.png webspec/trunk/src/main/resources/images/o.png webspec/trunk/src/main/resources/images/q.png webspec/trunk/src/main/resources/images/r.png webspec/trunk/src/main/resources/images/s.png webspec/trunk/src/main/resources/lang/ webspec/trunk/src/test/ webspec/trunk/src/test/java/ Property Changed: ---------------- webspec/trunk/ Property changes on: webspec/trunk ___________________________________________________________________ Added: svn:ignore + target build dist Added: webspec/trunk/LICENSE.txt =================================================================== --- webspec/trunk/LICENSE.txt (rev 0) +++ webspec/trunk/LICENSE.txt 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,341 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + Property changes on: webspec/trunk/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/pom.xml =================================================================== --- webspec/trunk/pom.xml (rev 0) +++ webspec/trunk/pom.xml 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,240 @@ +<?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>jetrix-spectator</artifactId> + <name>Jetrix Spectator</name> + <version>0.1-SNAPSHOT</version> + + <inceptionYear>2005</inceptionYear> + + <description> + Jetrix Spectator is a user friendly applet to connect to TetriNET servers as a spectator. + </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/webspec/trunk/</connection> + <developerConnection>scm:svn:https://jetrix.svn.sourceforge.net/svnroot/jetrix/webspec/trunk/</developerConnection> + <url>http://jetrix.svn.sourceforge.net/viewvc/jetrix/webspec/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> + + <dependencies> + <dependency> + <groupId>jetrix</groupId> + <artifactId>jetrix</artifactId> + <version>0.3-SNAPSHOT</version> + </dependency> + + <!-- Needed for testing --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <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> + <workingDirectory>target/test-classes</workingDirectory> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo.webstart</groupId> + <artifactId>webstart-maven-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>jnlp</goal> + </goals> + </execution> + </executions> + <configuration> + <excludeTransitive>true</excludeTransitive> + + <!-- The path where the libraries are stored within the jnlp structure. not required. by default the libraries are within the working directory --> + <libPath>lib</libPath> + + <!--resourcesDirectory>${project.basedir}/src/main/jnlp/resources</resourcesDirectory--> <!-- default value --> + + <!-- JNLP generation --> + <jnlp> + <!-- default values --> + <!--inputTemplateResourcePath>${project.basedir}</inputTemplateResourcePath--> + <!--inputTemplate>src/main/jnlp/template.vm</inputTemplate--> <!-- relative to inputTemplateResourcePath --> + <outputFile>jetrix-webspec.jnlp</outputFile> + + <!-- used to automatically identify the jar containing the main class. --> + <!-- this is perhaps going to change --> + <mainClass>net.jetrix.spectator.Spectator</mainClass> + </jnlp> + + <!-- SIGNING --> + <!-- defining this will automatically sign the jar and its dependencies, if necessary --> + <sign> + <keystore>jetrix.keystore</keystore> + <keypass>jetrix</keypass> + <storepass>jetrix</storepass> + <alias>jetrix</alias> + + <validity>3650</validity> + + <!-- only required for generating the keystore --> + <dnameCn>Jetrix</dnameCn> + <dnameOu></dnameOu> + <dnameO>Jetrix</dnameO> + <dnameL></dnameL> + <dnameSt></dnameSt> + <dnameC></dnameC> + + <verify>true</verify> + <!-- verify that the signing operation succeeded --> + + <!-- KEYSTORE MANAGEMENT --> + <keystoreConfig> + <delete>true</delete> + <!-- delete the keystore --> + <gen>true</gen> + <!-- optional shortcut to generate the store. --> + </keystoreConfig> + </sign> + + <!-- BUILDING PROCESS --> + + <pack200>true</pack200> + <gzip>true</gzip> + <!-- default force when pack200 false, true when pack200 selected ?? --> + + <!--install>false</install--> <!-- not yet supported --> + <verbose>false</verbose> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>net.jetrix.spectator.Spectator</mainClass> + </configuration> + </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> + </plugins> + </reporting> + +</project> Property changes on: webspec/trunk/pom.xml ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/PlayerResolver.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/PlayerResolver.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/PlayerResolver.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,38 @@ +/** + * Jetrix TetriNET Spectator + * Copyright (C) 2005 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.spectator; + +import net.jetrix.User; + +/** + * Retrieve user information from a slot number. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public interface PlayerResolver +{ + /** + * Return the details of the user at the specified slot. + * + * @param i slot number + */ + User getPlayer(int i); +} Property changes on: webspec/trunk/src/main/java/net/jetrix/spectator/PlayerResolver.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/Spectator.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/Spectator.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/Spectator.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,83 @@ +/** + * Jetrix TetriNET Spectator + * Copyright (C) 2005 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.spectator; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.IOException; + +import net.jetrix.spectator.ui.SpectatorFrame; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class Spectator +{ + private static final String HOSTNAME = "tetrinet.no"; + private static final String PASSWORD = "rien"; + + private static SpectatorAgent agent; + + public static void main(String[] argv) throws Exception + { + // agent setup + String name = "WebSpec-" + ((int) (Math.random() * 100000)); + agent = new SpectatorAgent(name, PASSWORD); + + // build the frame + final SpectatorFrame frame = new SpectatorFrame(agent); + frame.setSize(640, 520); + + Toolkit toolkit = Toolkit.getDefaultToolkit(); + toolkit.setDynamicLayout(true); + Dimension screenSize = toolkit.getScreenSize(); + frame.setLocation((int) (screenSize.getWidth() - frame.getWidth()) / 2, (int) (screenSize.getHeight() - frame.getHeight()) / 2); + + agent.setPanel(frame.getSpectatorPanel()); + + // register the listeners + frame.addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + frame.dispose(); + try + { + agent.disconnect(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + }); + + // show the frame + frame.setVisible(true); + + // connect to the server + agent.connect(HOSTNAME); + agent.join("#lfjr"); + } + +} Property changes on: webspec/trunk/src/main/java/net/jetrix/spectator/Spectator.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorAgent.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorAgent.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorAgent.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,113 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2005 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.spectator; + +import java.io.IOException; + +import net.jetrix.Field; +import net.jetrix.Message; +import net.jetrix.User; +import net.jetrix.agent.TSpecAgent; +import net.jetrix.messages.EndGameMessage; +import net.jetrix.messages.FieldMessage; +import net.jetrix.messages.IngameMessage; +import net.jetrix.messages.JoinMessage; +import net.jetrix.messages.LeaveMessage; +import net.jetrix.messages.NewGameMessage; +import net.jetrix.messages.SpecialMessage; +import net.jetrix.messages.TextMessage; +import net.jetrix.spectator.ui.SpectatorPanel; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class SpectatorAgent extends TSpecAgent +{ + private SpectatorPanel panel; + + protected void send(String message) throws IOException + { + super.send(message); + } + + public void onMessage(Message m) + { + if (m instanceof TextMessage) + { + panel.getChatPanel().append((TextMessage) m); + } + } + + public SpectatorAgent(String name, String password) + { + super(name, password); + } + + public void setPanel(SpectatorPanel panel) + { + this.panel = panel; + } + + public void onMessage(FieldMessage m) + { + Field field = panel.getField(m.getSlot() - 1); + field.update(m); + panel.repaint(); + } + + public void onMessage(JoinMessage m) + { + User player = new User(); + player.setName(m.getName()); + panel.setPlayer(m.getSlot() - 1, player); + panel.repaint(); + panel.getChatPanel().append(m); + } + + public void onMessage(LeaveMessage m) + { + panel.getChatPanel().append(m); + panel.setPlayer(m.getSlot() - 1, null); + panel.repaint(); + } + + public void onSpecial(SpecialMessage m) + { + panel.getGameEventsPanel().append(m); + } + + public void onMessage(NewGameMessage m) + { + panel.clearFields(); + panel.getGameEventsPanel().clear(); + panel.getChatPanel().append(m); + } + + public void onMessage(EndGameMessage m) + { + panel.getChatPanel().append(m); + } + + public void onMessage(IngameMessage m) + { + panel.getChatPanel().append(m); + } +} Property changes on: webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorAgent.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorApplet.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorApplet.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorApplet.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,108 @@ +/** + * Jetrix TetriNET Spectator + * Copyright (C) 2005 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.spectator; + +import java.awt.Dimension; +import java.io.IOException; +import javax.swing.JApplet; +import javax.swing.JMenuBar; + +import net.jetrix.spectator.ui.ChannelMenu; +import net.jetrix.spectator.ui.SpectatorPanel; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class SpectatorApplet extends JApplet +{ + private ChannelMenu menu; + private SpectatorAgent agent; + + public void init() + { + // agent setup + String name = getParameter("username"); + String password = getParameter("password"); + + if (name == null) + { + // generate a random name if no name was provided + name = "WebSpec-" + ((int) (Math.random() * 100000)); + } + agent = new SpectatorAgent(name, password); + + // build the frame + setPreferredSize(new Dimension(640, 520)); + + if (!"false".equals(getParameter("menu"))) + { + // add the menu bar + JMenuBar menuBar = new JMenuBar(); + menuBar.setVisible(true); + setJMenuBar(menuBar); + + menu = new ChannelMenu(agent); + menuBar.add(menu); + } + + // add the content + SpectatorPanel panel = new SpectatorPanel(); + getContentPane().add(panel); + + agent.setPanel(panel); + } + + public void start() + { + // connect to the server + try + { + agent.connect(getParameter("hostname")); + + String channel = getParameter("channel"); + if (channel != null && channel.trim().length() > 0) + { + agent.join(channel.trim()); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + public void stop() + { + if (menu != null) + { + menu.stop(); + } + + try + { + agent.disconnect(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } +} Property changes on: webspec/trunk/src/main/java/net/jetrix/spectator/SpectatorApplet.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChannelMenu.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChannelMenu.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChannelMenu.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,184 @@ +/** + * Jetrix TetriNET Spectator + * Copyright (C) 2005 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.spectator.ui; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.IOException; +import java.util.Enumeration; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import javax.swing.AbstractButton; +import javax.swing.ButtonGroup; +import javax.swing.JMenu; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; + +import net.jetrix.GameState; +import net.jetrix.agent.ChannelInfo; +import net.jetrix.agent.QueryAgent; +import net.jetrix.agent.TSpecAgent; +import net.jetrix.messages.CommandMessage; + +/** + * Menu containing the list of the channels available on the server. + * The channels are refreshed automatically + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ChannelMenu extends JMenu +{ + private Timer timer = new Timer(); + private List<ChannelInfo> channels; + private String channelName; + private TSpecAgent agent; + + public ChannelMenu(TSpecAgent agent) + { + this.agent = agent; + + setText("Channels"); + setEnabled(false); + + // start the timer refreshing the menu + timer.schedule(new TimerTask() + { + public void run() + { + try + { + refreshMenu(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + }, 1000, 10000); + + addMenuListener(new ChannelMenuListener()); + } + + public void stop() + { + timer.cancel(); + } + + private void refreshMenu() throws IOException + { + if (agent.getHostname() != null) + { + // retrieve the channel information + QueryAgent qagent = new QueryAgent(); + qagent.connect(agent.getHostname()); + channels = qagent.getChannels(); + qagent.disconnect(); + + if (channels != null && !channels.isEmpty()) + { + setEnabled(true); + } + } + } + + private void rebuild() + { + if (channels != null) + { + // build a new button group + ButtonGroup group = new ButtonGroup(); + for (ChannelInfo channel : channels) + { + JRadioButtonMenuItem item = new JRadioButtonMenuItem(); + item.setText(channel.getName() + " (" + channel.getPlayernum() + " / " + channel.getPlayermax() + ")"); + item.setActionCommand(channel.getName()); + + if (channel.getStatus() != GameState.STOPPED.getValue()) + { + // highlight active channels + item.setForeground(Color.GREEN); + } + else if (channel.isEmpty()) + { + // highlight non empty channels + item.setForeground(Color.LIGHT_GRAY); + } + + if (channel.getName().equals(channelName)) + { + item.setSelected(true); + } + + group.add(item); + } + + // define the action listener + final ActionListener actionListener = new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + String chan = e.getActionCommand(); + channelName = chan; + + CommandMessage command = new CommandMessage(); + command.setCommand("join"); + command.addParameter("#" + chan); + try + { + agent.send(command); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + }; + + // rebuild the menu + removeAll(); + + Enumeration<AbstractButton> it = group.getElements(); + while (it.hasMoreElements()) + { + AbstractButton button = it.nextElement(); + button.addActionListener(actionListener); + add(button); + } + } + + // todo: preserve the selected item + } + + class ChannelMenuListener implements MenuListener + { + public void menuSelected(MenuEvent e) + { + rebuild(); + } + + public void menuDeselected(MenuEvent e) { } + + public void menuCanceled(MenuEvent e) { } + } +} Property changes on: webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChannelMenu.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChatPanel.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChatPanel.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChatPanel.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,134 @@ +/** + * Jetrix TetriNET Spectator + * Copyright (C) 2005 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.spectator.ui; + +import net.jetrix.messages.*; +import net.jetrix.spectator.PlayerResolver; +import net.jetrix.User; + +import javax.swing.*; +import javax.swing.text.StyledDocument; +import java.awt.*; + +/** + * Text panel displaying the party line. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ChatPanel extends JScrollPane +{ + private StyledDocument doc; + private PlayerResolver resolver; + + public ChatPanel() + { + getInsets().set(0, 0, 0, 0); + + setPreferredSize(new Dimension(420, 250)); + setBorder(BorderFactory.createEtchedBorder()); + + JTextPane textPane = new JTextPane(); + textPane.setPreferredSize(getPreferredSize()); + textPane.setEditable(false); + textPane.getInsets().set(0, 0, 0, 0); + + setViewportView(textPane); + + doc = textPane.getStyledDocument(); + } + + public void setPlayerResolver(PlayerResolver resolver) + { + this.resolver = resolver; + } + + public void append(TextMessage message) + { + if (message instanceof GmsgMessage) + { + TetrinetColor.append(doc, "<i><gray>" + message.getText()); + } + else if (message instanceof PlineActMessage) + { + TetrinetColor.append(doc, "<purple>* <b>" + message.getSlot() + "</b> " + message.getText()); + } + else + { + StringBuffer buffer = new StringBuffer(); + + if (message.getSlot() == 0) + { + buffer.append("<<b><u>Server</u></b>> "); + } + else + { + User user = resolver.getPlayer(message.getSlot() - 1); + if (user != null) + { + buffer.append("<<b><u>" + user.getName() + "</u></b>> "); + } + } + + if (message.getText() != null) + { + buffer.append(message.getText()); + } + + TetrinetColor.append(doc, buffer.toString()); + } + + BoundedRangeModel bar = getVerticalScrollBar().getModel(); + bar.setValue(bar.getMaximum()); + } + + public void append(NewGameMessage message) + { + TetrinetColor.append(doc, "<red>*** The Game Has <b>Started</b>"); + } + + public void append(EndGameMessage message) + { + TetrinetColor.append(doc, "<red>*** The Game Has <b>Ended</b>"); + } + + public void append(IngameMessage m) + { + TetrinetColor.append(doc, "<red>*** The Game is in <b>Progress</b>"); + } + + public void append(JoinMessage m) + { + User user = resolver.getPlayer(m.getSlot() - 1); + if (user != null) + { + TetrinetColor.append(doc, "<green>*** <b>" + user.getName() + "</b> has joined"); + } + } + + public void append(LeaveMessage m) + { + User user = resolver.getPlayer(m.getSlot() - 1); + if (user != null) + { + TetrinetColor.append(doc, "<green>*** <b>" + user.getName() + "</b> has left"); + } + } +} Property changes on: webspec/trunk/src/main/java/net/jetrix/spectator/ui/ChatPanel.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/ui/FieldComponent.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/ui/FieldComponent.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/ui/FieldComponent.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,152 @@ +/** + * Jetrix TetriNET Spectator + * Copyright (C) 2005 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.spectator.ui; + +import net.jetrix.Field; +import net.jetrix.User; +import net.jetrix.config.Special; + +import javax.swing.*; +import java.awt.*; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import static net.jetrix.Field.*; +import static net.jetrix.config.Special.*; + +/** + * A Swing component displaying a player field. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class FieldComponent extends JComponent +{ + private Image background; + private Field field; + private User player; + private Map<Byte, Image> images; + + private int borderWidth = 1; + private int titleHeight = 15; + + public FieldComponent() + { + ClassLoader loader = this.getClass().getClassLoader(); + + // load the background image + URL url = loader.getResource("images/background.png"); + background = new ImageIcon(url).getImage(); + + // load the block images + images = new HashMap<Byte, Image>(); + images.put(BLOCK_BLUE, new ImageIcon(loader.getResource("images/1.png")).getImage()); + images.put(BLOCK_YELLOW, new ImageIcon(loader.getResource("images/2.png")).getImage()); + images.put(BLOCK_GREEN, new ImageIcon(loader.getResource("images/3.png")).getImage()); + images.put(BLOCK_PURPLE, new ImageIcon(loader.getResource("images/4.png")).getImage()); + images.put(BLOCK_RED, new ImageIcon(loader.getResource("images/5.png")).getImage()); + + for (Special special : Special.values()) + { + images.put(((byte) special.getLetter()), new ImageIcon(loader.getResource("images/" + special.getLetter() + ".png")).getImage()); + } + + field = new Field(); + } + + public Field getField() + { + return field; + } + + public void setField(Field field) + { + this.field = field; + repaint(); + } + + public User getPlayer() + { + return player; + } + + public void setPlayer(User player) + { + this.player = player; + } + + public void paint(Graphics g) + { + // draw the border + g.setColor(Color.black); + Dimension size = getPreferredSize(); + g.drawRect(0, 0, (int) size.getWidth() - 1, (int) size.getHeight() - 1); + + // draw the title + String text = null; + if (player != null) + { + g.setColor(Color.black); + g.setFont(new Font("sansserif", Font.PLAIN, 9)); + text = player.getName(); + } + else + { + g.setColor(Color.gray); + g.setFont(new Font("sansserif", Font.ITALIC, 9)); + text = "Empty"; + } + + int xpos = ((int) size.getWidth() - g.getFontMetrics().stringWidth(text)) / 2; + int ypos = (titleHeight + g.getFontMetrics().getAscent()) / 2; + g.drawString(text, xpos, ypos); + + // draw the separator + g.setColor(Color.black); + g.drawLine(0, titleHeight, (int) size.getWidth(), titleHeight); + + // draw the background + g.drawImage(background, borderWidth, borderWidth + titleHeight, background.getWidth(null), background.getHeight(null), this); + int blockWidth = background.getWidth(null) / Field.WIDTH; + int blockHeight = background.getHeight(null) / Field.HEIGHT; + + // draw the field + if (field != null) + { + for (int i = 0; i < Field.WIDTH; i++) + { + for (int j = 0; j < Field.HEIGHT; j++) + { + Image image = images.get(field.getBlock(i, Field.HEIGHT - j - 1)); + if (image != null) + { + g.drawImage(image, borderWidth + i * blockWidth, borderWidth + titleHeight + j * blockHeight, blockWidth, blockHeight, null); + } + } + } + } + } + + public Dimension getPreferredSize() + { + return new Dimension(background.getWidth(null) + 2 * borderWidth, background.getHeight(null) + 2 * borderWidth + titleHeight); + } +} Property changes on: webspec/trunk/src/main/java/net/jetrix/spectator/ui/FieldComponent.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: webspec/trunk/src/main/java/net/jetrix/spectator/ui/GameEventsPanel.java =================================================================== --- webspec/trunk/src/main/java/net/jetrix/spectator/ui/GameEventsPanel.java (rev 0) +++ webspec/trunk/src/main/java/net/jetrix/spectator/ui/GameEventsPanel.java 2008-08-28 08:20:33 UTC (rev 751) @@ -0,0 +1,160 @@ +/** + * Jetrix TetriNET Spectator + * Copyright (C) 2005 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.spectator.ui; + +import java.awt.Dimension; +import javax.swing.BorderFactory; +import javax.swing.BoundedRangeModel; +import javax.swing.JScrollPane; +import javax.swing.JTextPane; +import javax.swing.text.BadLocationException; +import javax.swing.text.StyledDocument; + +import net.jetrix.User; +import net.jetrix.messages.*; +import net.jetrix.spectator.PlayerResolver; + +/** + * Text panel displaying the events occuring during the game. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class GameEventsPanel extends JScrollPane +{ + private StyledDocument doc; + private PlayerResolver resolver; + + public GameEventsPanel() + { + setPreferredSize(new Dimension(185, 250)); + setBorder(BorderFactory.createEtchedBorder()); + + JTextPane textPane = new JTextPane(); + textPane.setPreferredSize(getPreferredSize()); + textPane.setEditable(false); + textPane.getInsets().set(0, 0, 0, 0); + + setViewportView(textPane); + + doc = textPane.getStyledDocument(); + } + + /** + * Clear the list of game events. + */ + public ... [truncated message content] |