[jetrix-cvs] SF.net SVN: jetrix:[729] monitor/trunk
Brought to you by:
smanux
From: <sm...@us...> - 2008-08-18 16:37:07
|
Revision: 729 http://jetrix.svn.sourceforge.net/jetrix/?rev=729&view=rev Author: smanux Date: 2008-08-18 16:35:43 +0000 (Mon, 18 Aug 2008) Log Message: ----------- New project: Jetrix Monitor Added Paths: ----------- monitor/trunk/lib/ monitor/trunk/lib/geoip-1.2.2.jar monitor/trunk/pom.xml monitor/trunk/src/ monitor/trunk/src/main/ monitor/trunk/src/main/java/ monitor/trunk/src/main/java/net/ monitor/trunk/src/main/java/net/jetrix/ monitor/trunk/src/main/java/net/jetrix/monitor/ monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java monitor/trunk/src/main/java/net/jetrix/monitor/dao/ monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java monitor/trunk/src/main/java/net/jetrix/monitor/job/ monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java monitor/trunk/src/main/java/net/jetrix/monitor/job/TransactionalQuartzJob.java monitor/trunk/src/main/resources/ monitor/trunk/src/main/resources/GeoIP.dat monitor/trunk/src/main/resources/applicationContext.xml monitor/trunk/src/main/resources/hibernate-mapping.xml monitor/trunk/src/main/resources/hibernate.cfg.xml monitor/trunk/src/main/resources/quartzContext.xml monitor/trunk/src/main/webapp/ monitor/trunk/src/main/webapp/META-INF/ monitor/trunk/src/main/webapp/META-INF/context.xml monitor/trunk/src/main/webapp/WEB-INF/ monitor/trunk/src/main/webapp/WEB-INF/classes/ monitor/trunk/src/main/webapp/WEB-INF/classes/logging.properties monitor/trunk/src/main/webapp/WEB-INF/lib/ monitor/trunk/src/main/webapp/WEB-INF/web.xml monitor/trunk/src/main/webapp/favicon.ico monitor/trunk/src/main/webapp/images/ monitor/trunk/src/main/webapp/images/flags/ monitor/trunk/src/main/webapp/images/flags/24/ monitor/trunk/src/main/webapp/images/flags/24/ASEAN.png monitor/trunk/src/main/webapp/images/flags/24/Afghanistan.png monitor/trunk/src/main/webapp/images/flags/24/African Union(OAS).png monitor/trunk/src/main/webapp/images/flags/24/Albania.png monitor/trunk/src/main/webapp/images/flags/24/Algeria.png monitor/trunk/src/main/webapp/images/flags/24/American Samoa.png monitor/trunk/src/main/webapp/images/flags/24/Andorra.png monitor/trunk/src/main/webapp/images/flags/24/Angola.png monitor/trunk/src/main/webapp/images/flags/24/Anguilla.png monitor/trunk/src/main/webapp/images/flags/24/Antarctica.png monitor/trunk/src/main/webapp/images/flags/24/Antigua & Barbuda.png monitor/trunk/src/main/webapp/images/flags/24/Arab League.png monitor/trunk/src/main/webapp/images/flags/24/Argentina.png monitor/trunk/src/main/webapp/images/flags/24/Armenia.png monitor/trunk/src/main/webapp/images/flags/24/Aruba.png monitor/trunk/src/main/webapp/images/flags/24/Australia.png monitor/trunk/src/main/webapp/images/flags/24/Austria.png monitor/trunk/src/main/webapp/images/flags/24/Azerbaijan.png monitor/trunk/src/main/webapp/images/flags/24/Bahamas.png monitor/trunk/src/main/webapp/images/flags/24/Bahrain.png monitor/trunk/src/main/webapp/images/flags/24/Bangladesh.png monitor/trunk/src/main/webapp/images/flags/24/Barbados.png monitor/trunk/src/main/webapp/images/flags/24/Belarus.png monitor/trunk/src/main/webapp/images/flags/24/Belgium.png monitor/trunk/src/main/webapp/images/flags/24/Belize.png monitor/trunk/src/main/webapp/images/flags/24/Benin.png monitor/trunk/src/main/webapp/images/flags/24/Bermuda.png monitor/trunk/src/main/webapp/images/flags/24/Bhutan.png monitor/trunk/src/main/webapp/images/flags/24/Bolivia.png monitor/trunk/src/main/webapp/images/flags/24/Bosnia & Herzegovina.png monitor/trunk/src/main/webapp/images/flags/24/Botswana.png monitor/trunk/src/main/webapp/images/flags/24/Brazil.png monitor/trunk/src/main/webapp/images/flags/24/Brunei.png monitor/trunk/src/main/webapp/images/flags/24/Bulgaria.png monitor/trunk/src/main/webapp/images/flags/24/Burkina Faso.png monitor/trunk/src/main/webapp/images/flags/24/Burundi.png monitor/trunk/src/main/webapp/images/flags/24/CARICOM.png monitor/trunk/src/main/webapp/images/flags/24/CIS.png monitor/trunk/src/main/webapp/images/flags/24/Cambodja.png monitor/trunk/src/main/webapp/images/flags/24/Cameroon.png monitor/trunk/src/main/webapp/images/flags/24/Canada.png monitor/trunk/src/main/webapp/images/flags/24/Cape Verde.png monitor/trunk/src/main/webapp/images/flags/24/Cayman Islands.png monitor/trunk/src/main/webapp/images/flags/24/Central African Republic.png monitor/trunk/src/main/webapp/images/flags/24/Chad.png monitor/trunk/src/main/webapp/images/flags/24/Chile.png monitor/trunk/src/main/webapp/images/flags/24/China.png monitor/trunk/src/main/webapp/images/flags/24/Colombia.png monitor/trunk/src/main/webapp/images/flags/24/Commonwealth.png monitor/trunk/src/main/webapp/images/flags/24/Comoros.png monitor/trunk/src/main/webapp/images/flags/24/Congo-Brazzaville.png monitor/trunk/src/main/webapp/images/flags/24/Congo-Kinshasa.png monitor/trunk/src/main/webapp/images/flags/24/Cook Islands.png monitor/trunk/src/main/webapp/images/flags/24/Costa Rica.png monitor/trunk/src/main/webapp/images/flags/24/Cote d'Ivoire.png monitor/trunk/src/main/webapp/images/flags/24/Croatia.png monitor/trunk/src/main/webapp/images/flags/24/Cuba.png monitor/trunk/src/main/webapp/images/flags/24/Cyprus.png monitor/trunk/src/main/webapp/images/flags/24/Czech Republic.png monitor/trunk/src/main/webapp/images/flags/24/Denmark.png monitor/trunk/src/main/webapp/images/flags/24/Djibouti.png monitor/trunk/src/main/webapp/images/flags/24/Dominica.png monitor/trunk/src/main/webapp/images/flags/24/Dominican Republic.png monitor/trunk/src/main/webapp/images/flags/24/East Timor.png monitor/trunk/src/main/webapp/images/flags/24/Egypt.png monitor/trunk/src/main/webapp/images/flags/24/El Salvador.png monitor/trunk/src/main/webapp/images/flags/24/England.png monitor/trunk/src/main/webapp/images/flags/24/Equador.png monitor/trunk/src/main/webapp/images/flags/24/Equatorial Guinea.png monitor/trunk/src/main/webapp/images/flags/24/Eritrea.png monitor/trunk/src/main/webapp/images/flags/24/Estonia.png monitor/trunk/src/main/webapp/images/flags/24/Ethiopia.png monitor/trunk/src/main/webapp/images/flags/24/European Union.png monitor/trunk/src/main/webapp/images/flags/24/Faroes.png monitor/trunk/src/main/webapp/images/flags/24/Fiji.png monitor/trunk/src/main/webapp/images/flags/24/Finland.png monitor/trunk/src/main/webapp/images/flags/24/France.png monitor/trunk/src/main/webapp/images/flags/24/Gabon.png monitor/trunk/src/main/webapp/images/flags/24/Gambia.png monitor/trunk/src/main/webapp/images/flags/24/Georgia.png monitor/trunk/src/main/webapp/images/flags/24/Germany.png monitor/trunk/src/main/webapp/images/flags/24/Ghana.png monitor/trunk/src/main/webapp/images/flags/24/Gibraltar.png monitor/trunk/src/main/webapp/images/flags/24/Greece.png monitor/trunk/src/main/webapp/images/flags/24/Greenland.png monitor/trunk/src/main/webapp/images/flags/24/Grenada.png monitor/trunk/src/main/webapp/images/flags/24/Guadeloupe.png monitor/trunk/src/main/webapp/images/flags/24/Guam.png monitor/trunk/src/main/webapp/images/flags/24/Guatemala.png monitor/trunk/src/main/webapp/images/flags/24/Guernsey.png monitor/trunk/src/main/webapp/images/flags/24/Guinea-Bissau.png monitor/trunk/src/main/webapp/images/flags/24/Guinea.png monitor/trunk/src/main/webapp/images/flags/24/Guyana.png monitor/trunk/src/main/webapp/images/flags/24/Haiti.png monitor/trunk/src/main/webapp/images/flags/24/Honduras.png monitor/trunk/src/main/webapp/images/flags/24/Hong Kong.png monitor/trunk/src/main/webapp/images/flags/24/Hungary.png monitor/trunk/src/main/webapp/images/flags/24/Iceland.png monitor/trunk/src/main/webapp/images/flags/24/India.png monitor/trunk/src/main/webapp/images/flags/24/Indonesia.png monitor/trunk/src/main/webapp/images/flags/24/Iran.png monitor/trunk/src/main/webapp/images/flags/24/Iraq.png monitor/trunk/src/main/webapp/images/flags/24/Ireland.png monitor/trunk/src/main/webapp/images/flags/24/Islamic Conference.png monitor/trunk/src/main/webapp/images/flags/24/Israel.png monitor/trunk/src/main/webapp/images/flags/24/Italy.png monitor/trunk/src/main/webapp/images/flags/24/Jamaica.png monitor/trunk/src/main/webapp/images/flags/24/Jersey.png monitor/trunk/src/main/webapp/images/flags/24/Jordan.png monitor/trunk/src/main/webapp/images/flags/24/Kazakhstan.png monitor/trunk/src/main/webapp/images/flags/24/Kenya.png monitor/trunk/src/main/webapp/images/flags/24/Kiribati.png monitor/trunk/src/main/webapp/images/flags/24/Kosovo.png monitor/trunk/src/main/webapp/images/flags/24/Kuwait.png monitor/trunk/src/main/webapp/images/flags/24/Kyrgyzstan.png monitor/trunk/src/main/webapp/images/flags/24/Laos.png monitor/trunk/src/main/webapp/images/flags/24/Latvia.png monitor/trunk/src/main/webapp/images/flags/24/Lebanon.png monitor/trunk/src/main/webapp/images/flags/24/Lesotho.png monitor/trunk/src/main/webapp/images/flags/24/Liberia.png monitor/trunk/src/main/webapp/images/flags/24/Libya.png monitor/trunk/src/main/webapp/images/flags/24/Liechtenstein.png monitor/trunk/src/main/webapp/images/flags/24/Lithuania.png monitor/trunk/src/main/webapp/images/flags/24/Luxembourg.png monitor/trunk/src/main/webapp/images/flags/24/Macao.png monitor/trunk/src/main/webapp/images/flags/24/Macedonia.png monitor/trunk/src/main/webapp/images/flags/24/Madagascar.png monitor/trunk/src/main/webapp/images/flags/24/Malawi.png monitor/trunk/src/main/webapp/images/flags/24/Malaysia.png monitor/trunk/src/main/webapp/images/flags/24/Maldives.png monitor/trunk/src/main/webapp/images/flags/24/Mali.png monitor/trunk/src/main/webapp/images/flags/24/Malta.png monitor/trunk/src/main/webapp/images/flags/24/Marshall Islands.png monitor/trunk/src/main/webapp/images/flags/24/Martinique.png monitor/trunk/src/main/webapp/images/flags/24/Mauritania.png monitor/trunk/src/main/webapp/images/flags/24/Mauritius.png monitor/trunk/src/main/webapp/images/flags/24/Mexico.png monitor/trunk/src/main/webapp/images/flags/24/Micronesia.png monitor/trunk/src/main/webapp/images/flags/24/Moldova.png monitor/trunk/src/main/webapp/images/flags/24/Monaco.png monitor/trunk/src/main/webapp/images/flags/24/Mongolia.png monitor/trunk/src/main/webapp/images/flags/24/Montenegro.png monitor/trunk/src/main/webapp/images/flags/24/Montserrat.png monitor/trunk/src/main/webapp/images/flags/24/Morocco.png monitor/trunk/src/main/webapp/images/flags/24/Mozambique.png monitor/trunk/src/main/webapp/images/flags/24/Myanmar(Burma).png monitor/trunk/src/main/webapp/images/flags/24/NATO.png monitor/trunk/src/main/webapp/images/flags/24/Namibia.png monitor/trunk/src/main/webapp/images/flags/24/Nauru.png monitor/trunk/src/main/webapp/images/flags/24/Nepal.png monitor/trunk/src/main/webapp/images/flags/24/Netherlands Antilles.png monitor/trunk/src/main/webapp/images/flags/24/Netherlands.png monitor/trunk/src/main/webapp/images/flags/24/New Caledonia.png monitor/trunk/src/main/webapp/images/flags/24/New Zealand.png monitor/trunk/src/main/webapp/images/flags/24/Nicaragua.png monitor/trunk/src/main/webapp/images/flags/24/Niger.png monitor/trunk/src/main/webapp/images/flags/24/Nigeria.png monitor/trunk/src/main/webapp/images/flags/24/North Korea.png monitor/trunk/src/main/webapp/images/flags/24/Northern Cyprus.png monitor/trunk/src/main/webapp/images/flags/24/Northern Ireland.png monitor/trunk/src/main/webapp/images/flags/24/Norway.png monitor/trunk/src/main/webapp/images/flags/24/OPEC.png monitor/trunk/src/main/webapp/images/flags/24/Olimpic Movement.png monitor/trunk/src/main/webapp/images/flags/24/Oman.png monitor/trunk/src/main/webapp/images/flags/24/Pakistan.png monitor/trunk/src/main/webapp/images/flags/24/Palau.png monitor/trunk/src/main/webapp/images/flags/24/Palestine.png monitor/trunk/src/main/webapp/images/flags/24/Panama.png monitor/trunk/src/main/webapp/images/flags/24/Papua New Guinea.png monitor/trunk/src/main/webapp/images/flags/24/Paraguay.png monitor/trunk/src/main/webapp/images/flags/24/Peru.png monitor/trunk/src/main/webapp/images/flags/24/Philippines.png monitor/trunk/src/main/webapp/images/flags/24/Poland.png monitor/trunk/src/main/webapp/images/flags/24/Portugal.png monitor/trunk/src/main/webapp/images/flags/24/Puerto Rico.png monitor/trunk/src/main/webapp/images/flags/24/Qatar.png monitor/trunk/src/main/webapp/images/flags/24/Red Cross.png monitor/trunk/src/main/webapp/images/flags/24/Reunion.png monitor/trunk/src/main/webapp/images/flags/24/Romania.png monitor/trunk/src/main/webapp/images/flags/24/Russia.png monitor/trunk/src/main/webapp/images/flags/24/Rwanda.png monitor/trunk/src/main/webapp/images/flags/24/Saint Lucia.png monitor/trunk/src/main/webapp/images/flags/24/Samoa.png monitor/trunk/src/main/webapp/images/flags/24/San Marino.png monitor/trunk/src/main/webapp/images/flags/24/Sao Tome & Principe.png monitor/trunk/src/main/webapp/images/flags/24/Saudi Arabia.png monitor/trunk/src/main/webapp/images/flags/24/Scotland.png monitor/trunk/src/main/webapp/images/flags/24/Senegal.png monitor/trunk/src/main/webapp/images/flags/24/Serbia(Yugoslavia).png monitor/trunk/src/main/webapp/images/flags/24/Seyshelles.png monitor/trunk/src/main/webapp/images/flags/24/Sierra Leone.png monitor/trunk/src/main/webapp/images/flags/24/Singapore.png monitor/trunk/src/main/webapp/images/flags/24/Slovakia.png monitor/trunk/src/main/webapp/images/flags/24/Slovenia.png monitor/trunk/src/main/webapp/images/flags/24/Solomon Islands.png monitor/trunk/src/main/webapp/images/flags/24/Somalia.png monitor/trunk/src/main/webapp/images/flags/24/Somaliland.png monitor/trunk/src/main/webapp/images/flags/24/South Africa.png monitor/trunk/src/main/webapp/images/flags/24/South Korea.png monitor/trunk/src/main/webapp/images/flags/24/Spain.png monitor/trunk/src/main/webapp/images/flags/24/Sri Lanka.png monitor/trunk/src/main/webapp/images/flags/24/St Kitts & Nevis.png monitor/trunk/src/main/webapp/images/flags/24/St Vincent & the Grenadines.png monitor/trunk/src/main/webapp/images/flags/24/Sudan.png monitor/trunk/src/main/webapp/images/flags/24/Suriname.png monitor/trunk/src/main/webapp/images/flags/24/Swaziland.png monitor/trunk/src/main/webapp/images/flags/24/Sweden.png monitor/trunk/src/main/webapp/images/flags/24/Switzerland.png monitor/trunk/src/main/webapp/images/flags/24/Syria.png monitor/trunk/src/main/webapp/images/flags/24/Tahiti(French Polinesia).png monitor/trunk/src/main/webapp/images/flags/24/Taiwan.png monitor/trunk/src/main/webapp/images/flags/24/Tajikistan.png monitor/trunk/src/main/webapp/images/flags/24/Tanzania.png monitor/trunk/src/main/webapp/images/flags/24/Thailand.png monitor/trunk/src/main/webapp/images/flags/24/Thumbs.db monitor/trunk/src/main/webapp/images/flags/24/Timor-Leste.png monitor/trunk/src/main/webapp/images/flags/24/Togo.png monitor/trunk/src/main/webapp/images/flags/24/Tonga.png monitor/trunk/src/main/webapp/images/flags/24/Trinidad & Tobago.png monitor/trunk/src/main/webapp/images/flags/24/Tunisia.png monitor/trunk/src/main/webapp/images/flags/24/Turkey.png monitor/trunk/src/main/webapp/images/flags/24/Turkmenistan.png monitor/trunk/src/main/webapp/images/flags/24/Turks and Caicos Islands.png monitor/trunk/src/main/webapp/images/flags/24/Tuvalu.png monitor/trunk/src/main/webapp/images/flags/24/Uganda.png monitor/trunk/src/main/webapp/images/flags/24/Ukraine.png monitor/trunk/src/main/webapp/images/flags/24/United Arab Emirates.png monitor/trunk/src/main/webapp/images/flags/24/United Kingdom(Great Britain).png monitor/trunk/src/main/webapp/images/flags/24/United Nations.png monitor/trunk/src/main/webapp/images/flags/24/United States.png monitor/trunk/src/main/webapp/images/flags/24/Uruguay.png monitor/trunk/src/main/webapp/images/flags/24/Uzbekistan.png monitor/trunk/src/main/webapp/images/flags/24/Vanuatu.png monitor/trunk/src/main/webapp/images/flags/24/Vatican City.png monitor/trunk/src/main/webapp/images/flags/24/Venezuela.png monitor/trunk/src/main/webapp/images/flags/24/Viet Nam.png monitor/trunk/src/main/webapp/images/flags/24/Virgin Islands British.png monitor/trunk/src/main/webapp/images/flags/24/Virgin Islands US.png monitor/trunk/src/main/webapp/images/flags/24/Wales.png monitor/trunk/src/main/webapp/images/flags/24/Western Sahara.png monitor/trunk/src/main/webapp/images/flags/24/Yemen.png monitor/trunk/src/main/webapp/images/flags/24/Zambia.png monitor/trunk/src/main/webapp/images/flags/24/Zimbabwe.png monitor/trunk/src/main/webapp/images/flags/24/japan.png monitor/trunk/src/main/webapp/images/flags/NOTICE.txt monitor/trunk/src/main/webapp/index.jsp monitor/trunk/src/main/webapp/scripts/ monitor/trunk/src/main/webapp/scripts/sortable.js monitor/trunk/src/main/webapp/server-add.jsp monitor/trunk/src/main/webapp/server.jsp monitor/trunk/src/main/webapp/servers-xml.jsp monitor/trunk/src/main/webapp/stylesheets/ monitor/trunk/src/main/webapp/stylesheets/style.css monitor/trunk/src/test/ monitor/trunk/src/test/java/ monitor/trunk/src/test/java/net/ monitor/trunk/src/test/java/net/jetrix/ monitor/trunk/src/test/java/net/jetrix/monitor/ monitor/trunk/src/test/java/net/jetrix/monitor/SpringTestCase.java monitor/trunk/src/test/java/net/jetrix/monitor/StyleUtilsTest.java monitor/trunk/src/test/java/net/jetrix/monitor/dao/ monitor/trunk/src/test/java/net/jetrix/monitor/dao/IpToCountryDaoTest.java monitor/trunk/src/test/java/net/jetrix/monitor/dao/ServerInfoDaoTest.java monitor/trunk/src/test/java/net/jetrix/monitor/job/ monitor/trunk/src/test/java/net/jetrix/monitor/job/GraphGenerationJobTest.java monitor/trunk/src/test/resources/ monitor/trunk/src/test/resources/testContext.xml Property Changed: ---------------- monitor/trunk/ Property changes on: monitor/trunk ___________________________________________________________________ Added: svn:ignore + target Property changes on: monitor/trunk/lib/geoip-1.2.2.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: monitor/trunk/pom.xml =================================================================== --- monitor/trunk/pom.xml (rev 0) +++ monitor/trunk/pom.xml 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>jetrix</groupId> + <artifactId>monitor</artifactId> + <name>Jetrix Monitor</name> + <version>1.0-SNAPSHOT</version> + <packaging>war</packaging> + + <inceptionYear>2001</inceptionYear> + + <description> + Jetrix monitor is a service monitoring the state of online TetriNET servers. + </description> + <url>http://jetrix.sourceforge.net</url> + + <licenses> + <license> + <name>GNU General Public License v2</name> + <url>http://www.gnu.org/licenses/gpl-2.0.txt</url> + <distribution>manual</distribution> + </license> + </licenses> + + <scm> + <connection>scm:svn:https://jetrix.svn.sourceforge.net/svnroot/jetrix/monitor/trunk/</connection> + <developerConnection>scm:svn:https://jetrix.svn.sourceforge.net/svnroot/jetrix/monitor/trunk/</developerConnection> + <url>http://jetrix.svn.sourceforge.net/viewvc/jetrix/monitor/trunk</url> + </scm> + + <mailingLists> + <mailingList> + <name>Jetrix Commits</name> + <subscribe>http://lists.sourceforge.net/lists/listinfo/jetrix-cvs</subscribe> + <unsubscribe>http://lists.sourceforge.net/lists/listinfo/jetrix-cvs</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_id=12998</archive> + </mailingList> + </mailingLists> + + <developers> + <developer> + <id>smanux</id> + <name>Emmanuel Bourg</name> + <email>eb...@ap...</email> + <timezone>+1</timezone> + </developer> + </developers> + + <repositories> + <repository> + <id>java.net</id> + <url>http://download.java.net/maven/2/</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + <repository> + <id>opennms-repo</id> + <name>OpenNMS Repository</name> + <url>http://repo.opennms.org/maven2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <dependencies> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.6.ga</version> + </dependency> + + <dependency> + <groupId>org.springframework </groupId> + <artifactId>spring</artifactId> + <version>2.5.5</version> + </dependency> + + <dependency> + <groupId>opensymphony</groupId> + <artifactId>quartz</artifactId> + <version>1.6.0</version> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.1</version> + </dependency> + + <dependency> + <groupId>maxmind</groupId> + <artifactId>geoip</artifactId> + <version>1.2.2</version> + </dependency> + + <dependency> + <groupId>org.jrobin</groupId> + <artifactId>jrobin</artifactId> + <version>1.5.8</version> + </dependency> + + <dependency> + <groupId>jetrix</groupId> + <artifactId>jetrix</artifactId> + <version>0.3-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>javax.servlet.jsp</groupId> + <artifactId>jsp-api</artifactId> + <version>2.1</version> + <scope>provided</scope> + </dependency> + + <!-- Needed for testing --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.6</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <testSourceDirectory>src/test/java</testSourceDirectory> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>**/*Test.java</include> + </includes> + <excludes> + <exclude>**/Abstract*</exclude> + </excludes> + <testFailureIgnore>true</testFailureIgnore> + <skip>false</skip> + </configuration> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <configuration> + <file>lib/geoip-1.2.2.jar</file> + <groupId>maxmind</groupId> + <artifactId>geoip</artifactId> + <version>1.2.2</version> + <packaging>jar</packaging> + <generatePom>true</generatePom> + <createChecksum>true</createChecksum> + </configuration> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>install-file</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <linksource>true</linksource> + <links> + <link>http://java.sun.com/javase/6/docs/api</link> + </links> + <quiet>true</quiet> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>javadoc</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <targetJdk>1.5</targetJdk> + </configuration> + </plugin> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <reportSets> + <reportSet> + <reports> + <report>project-team</report> + <report>dependencies</report> + <report>license</report> + <report>scm</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <version>2.0</version> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jxr-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>taglist-maven-plugin</artifactId> + <version>2.0</version> + <configuration> + <tags> + <tag>todo</tag> + </tags> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changelog-plugin</artifactId> + <configuration> + <range>365</range> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>changelog</report> + <report>file-activity</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> + +</project> Property changes on: monitor/trunk/pom.xml ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,78 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.UnknownHostException; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class NetworkUtils +{ + public static boolean isPortOpen(String address, int port) + { + try + { + return isPortOpen(InetAddress.getByName(address), port); + } + catch (UnknownHostException e) + { + return false; + } + } + + /** + * Check if the specified port is open. + * + * @param address + * @param port + */ + public static boolean isPortOpen(InetAddress address, int port) + { + Socket socket = new Socket(); + + try + { + socket.connect(new InetSocketAddress(address, port), 5000); + socket.close(); + return true; + } + catch (IOException e) + { + return false; + } + finally + { + try + { + socket.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,252 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import net.jetrix.agent.ChannelInfo; +import net.jetrix.agent.PlayerInfo; + +/** + * Information about a TetriNET server. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerInfo +{ + private long id; + private String hostname; + private String IP; + private String version; + private String description; + private boolean spectate; + private String country; + private String website; + + private Date dateAdded; + private Date lastChecked; + private Date lastOnline; + + private ServerStats stats = new ServerStats(); + + private int maxPlayerCount; + private Date maxPlayerDate; + + private int maxActivePlayerCount; + private Date maxActivePlayerDate; + + private List<ChannelInfo> channels; + private List<PlayerInfo> players; + + private Collection<String> aliases; + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getHostname() + { + return hostname; + } + + public void setHostname(String hostname) + { + this.hostname = hostname; + } + + public String getIP() + { + return IP; + } + + public void setIP(String IP) + { + this.IP = IP; + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public boolean isSpectate() + { + return spectate; + } + + public void setSpectate(boolean spectate) + { + this.spectate = spectate; + } + + public String getCountry() + { + return country; + } + + public void setCountry(String country) + { + this.country = country; + } + + public String getWebsite() + { + return website; + } + + public void setWebsite(String website) + { + this.website = website; + } + + public Date getDateAdded() + { + return dateAdded; + } + + public void setDateAdded(Date dateAdded) + { + this.dateAdded = dateAdded; + } + + public Date getLastChecked() + { + return lastChecked; + } + + public void setLastChecked(Date lastChecked) + { + this.lastChecked = lastChecked; + } + + public Date getLastOnline() + { + return lastOnline; + } + + public void setLastOnline(Date lastOnline) + { + this.lastOnline = lastOnline; + } + + public ServerStats getStats() + { + return stats; + } + + public void setStats(ServerStats stats) + { + this.stats = stats; + } + + public int getMaxPlayerCount() + { + return maxPlayerCount; + } + + public void setMaxPlayerCount(int maxPlayerCount) + { + this.maxPlayerCount = maxPlayerCount; + } + + public Date getMaxPlayerDate() + { + return maxPlayerDate; + } + + public void setMaxPlayerDate(Date maxPlayerDate) + { + this.maxPlayerDate = maxPlayerDate; + } + + public int getMaxActivePlayerCount() + { + return maxActivePlayerCount; + } + + public void setMaxActivePlayerCount(int maxActivePlayerCount) + { + this.maxActivePlayerCount = maxActivePlayerCount; + } + + public Date getMaxActivePlayerDate() + { + return maxActivePlayerDate; + } + + public void setMaxActivePlayerDate(Date maxActivePlayerDate) + { + this.maxActivePlayerDate = maxActivePlayerDate; + } + + public List<ChannelInfo> getChannels() + { + return channels; + } + + public void setChannels(List<ChannelInfo> channels) + { + this.channels = channels; + } + + public List<PlayerInfo> getPlayers() + { + return players; + } + + public void setPlayers(List<PlayerInfo> players) + { + this.players = players; + } + + public Collection<String> getAliases() + { + return aliases; + } + + public void setAliases(Collection<String> aliases) + { + this.aliases = aliases; + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,168 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.util.Date; + +import net.jetrix.agent.ChannelInfo; +import net.jetrix.agent.PlayerInfo; +import net.jetrix.agent.QueryInfo; + +/** + * Server stats at a given time. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerStats +{ + private long id; + private long serverId; + private Date date; + private int ping; + private int playerCount; + private int activePlayerCount; + private int channelCount; + private int activeChannelCount; + + public void update(QueryInfo info) + { + date = new Date(); + ping = (int) info.getPing(); + playerCount = info.getPlayers().size(); + channelCount = info.getChannels().size(); + + int activePlayerCount = 0; + int activeChannelCount = 0; + + for (PlayerInfo player : info.getPlayers()) + { + if (player.isPlaying()) + { + activePlayerCount++; + } + } + + for (ChannelInfo channel : info.getChannels()) + { + if (channel.isPlaying()) + { + activeChannelCount++; + } + } + + this.activePlayerCount = activePlayerCount; + this.activeChannelCount = activeChannelCount; + } + + /** + * Merge the best player/channel count into the current ServerStat instance. + * + * @param stats + */ + public void merge(ServerStats stats) + { + playerCount = Math.max(playerCount, stats.playerCount); + activePlayerCount = Math.max(activePlayerCount, stats.activePlayerCount); + + channelCount = Math.max(channelCount, stats.channelCount); + activeChannelCount = Math.max(activeChannelCount, stats.activeChannelCount); + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public long getServerId() + { + return serverId; + } + + public void setServerId(long serverId) + { + this.serverId = serverId; + } + + public Date getDate() + { + return date; + } + + public void setDate(Date date) + { + this.date = date; + } + + public int getPing() + { + return ping; + } + + public void setPing(int ping) + { + this.ping = ping; + } + + public int getPlayerCount() + { + return playerCount; + } + + public void setPlayerCount(int playerCount) + { + this.playerCount = playerCount; + } + + public int getActivePlayerCount() + { + return activePlayerCount; + } + + public void setActivePlayerCount(int activePlayerCount) + { + this.activePlayerCount = activePlayerCount; + } + + public int getChannelCount() + { + return channelCount; + } + + public void setChannelCount(int channelCount) + { + this.channelCount = channelCount; + } + + public int getActiveChannelCount() + { + return activeChannelCount; + } + + public void setActiveChannelCount(int activeChannelCount) + { + this.activeChannelCount = activeChannelCount; + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,92 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Map; +import java.util.HashMap; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class StyleUtils +{ + /** TetriNET to CSS style mapping */ + private static final Map<Character, String> STYLES = new HashMap<Character, String>(); + static + { + STYLES.put('\u0014', "color: red"); + STYLES.put('\u0004', "color: black"); + STYLES.put('\u000c', "color: green"); + STYLES.put('\u000e', "color: lightgreen"); + STYLES.put('\u0011', "color: darkblue"); + STYLES.put('\u0005', "color: blue"); + STYLES.put('\u0003', "color: cyan"); + STYLES.put('\u0017', "color: aqua"); + STYLES.put('\u0019', "color: yellow"); + STYLES.put('\u0012', "color: kaki"); + STYLES.put('\u0010', "color: brown"); + STYLES.put('\u000f', "color: lightgray"); + STYLES.put('\u0006', "color: gray"); + STYLES.put('\u0008', "color: magenta"); + STYLES.put('\u0013', "color: purple"); + STYLES.put('\u0002', "font-weight: bold"); + STYLES.put('\u0016', "font-style: italic"); + STYLES.put('\u001f', "text-decoration: underlined"); + STYLES.put('\u0018', "color: white"); + } + + public static String toHTML(String text) + { + StringBuilder result = new StringBuilder(); + + Deque<Character> styleStack = new ArrayDeque<Character>(); + + for (char c : text.toCharArray()) + { + if (STYLES.keySet().contains(c)) + { + if (styleStack.isEmpty() || styleStack.peek().charValue() != c) + { + styleStack.push(c); + result.append("<span style=\"" + STYLES.get(c) + "\">"); + } + else + { + styleStack.pop(); + result.append("</span>"); + } + } + else + { + result.append(c); + } + } + + while (styleStack.pollFirst() != null) + { + result.append("</span>"); + } + + return result.toString(); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,61 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.dao; + +import java.io.IOException; +import java.io.File; +import java.net.InetAddress; +import java.net.URL; + +import com.maxmind.geoip.Country; +import com.maxmind.geoip.LookupService; +import static com.maxmind.geoip.LookupService.GEOIP_CHECK_CACHE; +import static com.maxmind.geoip.LookupService.GEOIP_MEMORY_CACHE; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class IpToCountryDao +{ + private LookupService service; + + public IpToCountryDao() throws Exception + { + URL url = getClass().getResource("/GeoIP.dat"); + File file = new File(url.toURI()); + String fileName = file.getAbsolutePath(); + + this.service = new LookupService(fileName, GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE); + } + + /** + * Returns the country code matching this address, or null if the country can't be found. + * + * @param address + */ + public String getCountry(InetAddress address) + { + Country country = service.getCountry(address); + + return country != null && !"--".equals(country.getCode()) ? country.getCode() : null; + } + +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,78 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.dao; + +import java.util.List; + +import org.hibernate.Query; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import net.jetrix.monitor.ServerInfo; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerInfoDao extends HibernateDaoSupport +{ + public ServerInfo getServer(long id) + { + return (ServerInfo) getSession().get(ServerInfo.class, id); + } + + public ServerInfo getServer(String hostname) + { + Query query = getSession().createQuery("FROM ServerInfo WHERE hostname = :hostname"); + query.setParameter("hostname", hostname); + + return (ServerInfo) query.uniqueResult(); + } + + public List<ServerInfo> getServers() + { + return getSession().createQuery("FROM ServerInfo ORDER BY stats.playerCount DESC, hostname").list(); + } + + public void save(ServerInfo server) + { + getSession().saveOrUpdate(server); + } + + public void remove(long id) + { + Object server = getSession().load(ServerInfo.class, id); + getSession().delete(server); + } + + /** + * Check if the hostname or IP address of the specified server already exist in the database. + * + * @param server + */ + public boolean exists(ServerInfo server) + { + Query query = getSession().createQuery("FROM ServerInfo WHERE IP = :ip OR hostname = :name"); + query.setParameter("ip", server.getIP()); + query.setParameter("name", server.getHostname()); + List result = query.list(); + + return !result.isEmpty(); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,47 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.dao; + +import java.util.List; + +import org.hibernate.Query; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import net.jetrix.monitor.ServerStats; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerStatsDao extends HibernateDaoSupport +{ + public List<ServerStats> getStats(long serverId) + { + Query query = getSession().createQuery("FROM ServerStats WHERE serverId=:id ORDER BY date"); + query.setParameter("id", serverId); + + return (List<ServerStats>) query.list(); + } + + public void save(ServerStats stats) + { + getSession().saveOrUpdate(stats); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,213 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.job; + +import java.awt.Color; +import java.io.File; +import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.logging.Level; +import javax.servlet.ServletContext; + +import org.jrobin.core.RrdDb; +import org.jrobin.core.RrdDef; +import org.jrobin.core.RrdException; +import org.jrobin.core.Sample; +import org.jrobin.core.Util; +import org.jrobin.graph.RrdGraph; +import org.jrobin.graph.RrdGraphDef; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.ContextLoader; + +import net.jetrix.monitor.ServerInfo; +import net.jetrix.monitor.ServerStats; +import net.jetrix.monitor.dao.ServerInfoDao; +import net.jetrix.monitor.dao.ServerStatsDao; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class GraphGenerationJob extends TransactionalQuartzJob +{ + public static final String DEFAULT_DATAPATH = System.getProperty("user.home") + "/.jetrix"; + + private String dataPath = DEFAULT_DATAPATH; + private String outpoutPath = DEFAULT_DATAPATH; + + public void setDataPath(String dataPath) + { + this.dataPath = dataPath; + } + + public void setOutpoutPath(String outpoutPath) + { + this.outpoutPath = outpoutPath; + } + + protected void executeTransactional(JobExecutionContext jobExecutionContext) throws JobExecutionException + { + log.info("Generating graphs..."); + + ApplicationContext context = (ApplicationContext) jobExecutionContext.getMergedJobDataMap().get("applicationContext"); + + ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); + setOutpoutPath(servletContext.getRealPath("/images/graphs")); + + ServerInfoDao serverInfoDao = (ServerInfoDao) context.getBean("serverInfoDao"); + ServerStatsDao serverStatsDao = (ServerStatsDao) context.getBean("serverStatsDao"); + + List<ServerInfo> servers = serverInfoDao.getServers(); + + for (ServerInfo server : servers) + { + try + { + List<ServerStats> stats = serverStatsDao.getStats(server.getId()); + generateGraph(server, stats); + } + catch (Exception e) + { + log.log(Level.WARNING, "Unable to draw the activity graph for " + server.getHostname() + " (" + server.getId() + ")", e); + } + } + } + + private File getRRDFile(ServerInfo server) + { + return new File(dataPath, "server-" + server.getId() + ".rrd"); + } + + protected void generateGraph(ServerInfo server, List<ServerStats> stats) throws RrdException, IOException + { + boolean update= updateDatabase(server,stats); + if (update) + { + generateGraph(server, 1); + } + } + + private boolean updateDatabase(ServerInfo server, List<ServerStats> stats) throws IOException, RrdException + { + if (stats.isEmpty()) + { + return false; + } + + File file = getRRDFile(server); + if (!file.exists()) + { + createDatabase(server, stats.get(0).getDate()); + } + + RrdDb rrdDb = new RrdDb(file.getAbsolutePath()); + + try + { + Sample sample = rrdDb.createSample(); + for (ServerStats stat : stats) + { + long timestamp = Util.getTimestamp(stat.getDate()); + if (timestamp > rrdDb.getLastUpdateTime()) + { + sample.setTime(timestamp); + sample.setValue("players", stat.getPlayerCount()); + sample.setValue("activePlayers", stat.getActivePlayerCount()); + sample.update(); + } + } + } + finally + { + rrdDb.close(); + } + + return true; + } + + private void createDatabase(ServerInfo server, Date startDate) throws IOException, RrdException + { + File file = getRRDFile(server); + file.getParentFile().mkdirs(); + + RrdDef def = new RrdDef(file.getAbsolutePath()); + def.setStartTime(Util.getTimestamp(startDate) - 1); + def.setStep(300); + + def.addDatasource("players", "GAUGE", 600, 0, Double.NaN); + def.addDatasource("activePlayers", "GAUGE", 600, 0, Double.NaN); + def.addArchive("AVERAGE", 0.5, 1, 1000000); + + RrdDb rrdDb = new RrdDb(def); + rrdDb.close(); + } + + private void generateGraph(ServerInfo server, int days) throws IOException, RrdException + { + RrdGraphDef graph = new RrdGraphDef(); + + // scale + graph.setStartTime(System.currentTimeMillis() / 1000 - days * 24 * 3600); + graph.setEndTime(System.currentTimeMillis() / 1000); + graph.setMinValue(0); + if (server.getMaxPlayerCount() < 10) + { + graph.setValueAxis(1, 1); + graph.setMaxValue(10); + } + + // data + File file = getRRDFile(server); + graph.datasource("players", file.getAbsolutePath(), "players", "AVERAGE"); + graph.datasource("activePlayers", file.getAbsolutePath(), "activePlayers", "AVERAGE"); + graph.area("players", new Color(141, 255, 141), "Players"); + graph.area("activePlayers", Color.GREEN, "Active Players"); + graph.hrule(server.getMaxPlayerCount(), Color.RED, "Max players"); + + // style + //graph.setTitle(server.getHostname().toUpperCase()); + graph.setVerticalLabel("Players"); + graph.setUnitsLength(7); + graph.setAntiAliasing(true); + graph.setShowSignature(false); + graph.setSignature(server.getHostname()); + graph.setNoLegend(true); + graph.setColor(RrdGraph.COLOR_SHADEA, Color.WHITE); + graph.setColor(RrdGraph.COLOR_SHADEB, Color.WHITE); + graph.setColor(RrdGraph.COLOR_BACK, Color.WHITE); + graph.setColor(RrdGraph.COLOR_ARROW, Color.WHITE); + + // output + File gfile = new File(outpoutPath, "server-" + server.getId() + ".png"); + gfile.getParentFile().mkdirs(); + graph.setWidth(400); + graph.setHeight(300); + graph.setFilename(gfile.getAbsolutePath()); + graph.setImageFormat("png"); + graph.setPoolUsed(false); + + new RrdGraph(graph); + + log.fine("Done generating " + gfile); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java ==... [truncated message content] |