1.1 --- a/webidor/nb-configuration.xml Sun May 01 21:10:07 2011 +0200
1.2 +++ b/webidor/nb-configuration.xml Sun Jul 17 15:40:50 2011 +0200
1.3 @@ -26,18 +26,6 @@
1.4 therefore it is assumed to be part of version control checkout.
1.5 Without this configuration present, some functionality in the IDE may be limited or fail altogether.
1.6 -->
1.7 - <spring-data xmlns="http://www.netbeans.org/ns/spring-data/1">
1.8 - <config-files>
1.9 - <config-file>src/main/webapp/WEB-INF/applicationContext.xml</config-file>
1.10 - <config-file>src/main/webapp/WEB-INF/dispatcher-servlet.xml</config-file>
1.11 - </config-files>
1.12 - <config-file-groups>
1.13 - <config-file-group name="Default Group">
1.14 - <config-file>src/main/webapp/WEB-INF/applicationContext.xml</config-file>
1.15 - <config-file>src/main/webapp/WEB-INF/dispatcher-servlet.xml</config-file>
1.16 - </config-file-group>
1.17 - </config-file-groups>
1.18 - </spring-data>
1.19 <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
1.20 <!--
1.21 Properties that influence various parts of the IDE, especially code formatting and the like.
1.22 @@ -45,6 +33,6 @@
1.23 That way multiple projects can share the same settings (useful for formatting rules for example).
1.24 Any value defined here will override the pom.xml file value but is only applicable to the current project.
1.25 -->
1.26 - <netbeans.compile.on.save>none</netbeans.compile.on.save>
1.27 + <org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>user</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
1.28 </properties>
1.29 </project-shared-configuration>
2.1 --- a/webidor/nbactions.xml Sun May 01 21:10:07 2011 +0200
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,60 +0,0 @@
2.4 -<?xml version="1.0" encoding="UTF-8"?>
2.5 -<!--
2.6 -
2.7 - Quoridor server and related libraries
2.8 - Copyright (C) 2009-2010 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.9 -
2.10 - This program is free software: you can redistribute it and/or modify
2.11 - it under the terms of the GNU General Public License as published by
2.12 - the Free Software Foundation, either version 3 of the License.
2.13 -
2.14 - This program is distributed in the hope that it will be useful,
2.15 - but WITHOUT ANY WARRANTY; without even the implied warranty of
2.16 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.17 - GNU General Public License for more details.
2.18 -
2.19 - You should have received a copy of the GNU General Public License
2.20 - along with this program. Look for COPYING file in the top folder.
2.21 - If not, see http://www.gnu.org/licenses/.
2.22 -
2.23 --->
2.24 -
2.25 -<actions>
2.26 - <action>
2.27 - <actionName>run</actionName>
2.28 - <goals>
2.29 - <goal>process-classes</goal>
2.30 - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
2.31 - </goals>
2.32 - <properties>
2.33 - <exec.classpathScope>runtime</exec.classpathScope>
2.34 - <exec.args>-classpath %classpath cz.xelfi.quoridor.webidor.resources.Quoridor</exec.args>
2.35 - <exec.executable>java</exec.executable>
2.36 - </properties>
2.37 - </action>
2.38 - <action>
2.39 - <actionName>debug</actionName>
2.40 - <goals>
2.41 - <goal>process-classes</goal>
2.42 - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
2.43 - </goals>
2.44 - <properties>
2.45 - <exec.classpathScope>runtime</exec.classpathScope>
2.46 - <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath cz.xelfi.quoridor.webidor.resources.Quoridor</exec.args>
2.47 - <jpda.listen>true</jpda.listen>
2.48 - <exec.executable>java</exec.executable>
2.49 - </properties>
2.50 - </action>
2.51 - <action>
2.52 - <actionName>profile</actionName>
2.53 - <goals>
2.54 - <goal>process-classes</goal>
2.55 - <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
2.56 - </goals>
2.57 - <properties>
2.58 - <exec.args>${profiler.args} -classpath %classpath cz.xelfi.quoridor.webidor.resources.Quoridor</exec.args>
2.59 - <profiler.action>profile</profiler.action>
2.60 - <exec.executable>${profiler.java}</exec.executable>
2.61 - </properties>
2.62 - </action>
2.63 - </actions>
3.1 --- a/webidor/pom.xml Sun May 01 21:10:07 2011 +0200
3.2 +++ b/webidor/pom.xml Sun Jul 17 15:40:50 2011 +0200
3.3 @@ -8,116 +8,128 @@
3.4 <groupId>cz.xelfi.quoridor</groupId>
3.5 <version>1.0</version>
3.6 </parent>
3.7 + <groupId>cz.xelfi.quoridor</groupId>
3.8 <artifactId>webidor</artifactId>
3.9 - <packaging>jar</packaging>
3.10 + <packaging>war</packaging>
3.11 <version>${webidorVersion}</version>
3.12 <name>webidor server</name>
3.13 <url>http://maven.apache.org</url>
3.14 - <dependencies>
3.15 - <dependency>
3.16 - <groupId>junit</groupId>
3.17 - <artifactId>junit</artifactId>
3.18 - <version>4.5</version>
3.19 - <scope>test</scope>
3.20 - </dependency>
3.21 - <dependency>
3.22 - <groupId>com.sun.jersey</groupId>
3.23 - <artifactId>jersey-core</artifactId>
3.24 - <version>${jerseyVersion}</version>
3.25 - </dependency>
3.26 - <dependency>
3.27 - <groupId>com.sun.jersey</groupId>
3.28 - <artifactId>jersey-grizzly2</artifactId>
3.29 - <version>${jerseyVersion}</version>
3.30 - </dependency>
3.31 - <dependency>
3.32 - <groupId>com.sun.jersey</groupId>
3.33 - <artifactId>jersey-json</artifactId>
3.34 - <version>${jerseyVersion}</version>
3.35 - <type>jar</type>
3.36 - <exclusions>
3.37 - <exclusion>
3.38 - <artifactId>jaxb-api</artifactId>
3.39 - <groupId>javax.xml.bind</groupId>
3.40 - </exclusion>
3.41 - <exclusion>
3.42 - <artifactId>stax-api</artifactId>
3.43 - <groupId>stax</groupId>
3.44 - </exclusion>
3.45 - </exclusions>
3.46 - </dependency>
3.47 - <dependency>
3.48 - <groupId>com.sun.jersey.jersey-test-framework</groupId>
3.49 - <artifactId>jersey-test-framework-http</artifactId>
3.50 - <version>${jerseyVersion}</version>
3.51 - <scope>test</scope>
3.52 - </dependency>
3.53 - <dependency>
3.54 - <groupId>cz.xelfi.quoridor</groupId>
3.55 - <artifactId>quoridor</artifactId>
3.56 - <version>${quoridorVersion}</version>
3.57 - <type>jar</type>
3.58 - </dependency>
3.59 - <dependency>
3.60 - <groupId>${project.groupId}</groupId>
3.61 - <artifactId>wsdor</artifactId>
3.62 - <version>${wsdorVersion}</version>
3.63 - </dependency>
3.64 - </dependencies>
3.65 - <build>
3.66 - <plugins>
3.67 - <plugin>
3.68 - <groupId>org.apache.maven.plugins</groupId>
3.69 - <artifactId>maven-compiler-plugin</artifactId>
3.70 - <version>2.0.2</version>
3.71 - <configuration>
3.72 - <source>1.5</source>
3.73 - <target>1.5</target>
3.74 - </configuration>
3.75 - </plugin>
3.76 - <plugin>
3.77 - <groupId>org.codehaus.mojo</groupId>
3.78 - <artifactId>exec-maven-plugin</artifactId>
3.79 - <configuration>
3.80 - <mainClass>cz.xelfi.quoridor.webidor.resources.Quoridor</mainClass>
3.81 - </configuration>
3.82 - </plugin>
3.83 - <plugin>
3.84 - <artifactId>maven-assembly-plugin</artifactId>
3.85 - <version>2.2-beta-2</version>
3.86 - <executions>
3.87 - <execution>
3.88 - <id>create-executable-jar</id>
3.89 - <phase>package</phase>
3.90 - <goals>
3.91 - <goal>single</goal>
3.92 - </goals>
3.93 - <configuration>
3.94 - <descriptors>
3.95 - <descriptor>all-zip.xml</descriptor>
3.96 - </descriptors>
3.97 - <finalName>webidor-${version}</finalName>
3.98 - </configuration>
3.99 - </execution>
3.100 - </executions>
3.101 - </plugin>
3.102 - <plugin>
3.103 - <groupId>org.apache.maven.plugins</groupId>
3.104 - <artifactId>maven-jar-plugin</artifactId>
3.105 - <configuration>
3.106 - <archive>
3.107 - <manifest>
3.108 - <addClasspath>true</addClasspath>
3.109 - <classpathPrefix>lib/</classpathPrefix>
3.110 - <mainClass>cz.xelfi.quoridor.webidor.resources.Quoridor</mainClass>
3.111 - </manifest>
3.112 - </archive>
3.113 - </configuration>
3.114 - </plugin>
3.115 - </plugins>
3.116 - </build>
3.117 - <description>Server with REST API for playing, inspecting and managing Quoridor games.</description>
3.118 + <properties>
3.119 + <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
3.120 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3.121 + <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
3.122 + </properties>
3.123 +
3.124 + <dependencies>
3.125 + <dependency>
3.126 + <groupId>javax</groupId>
3.127 + <artifactId>javaee-web-api</artifactId>
3.128 + <version>6.0</version>
3.129 + <scope>provided</scope>
3.130 + </dependency>
3.131 +
3.132 + <dependency>
3.133 + <groupId>junit</groupId>
3.134 + <artifactId>junit</artifactId>
3.135 + <version>4.8.2</version>
3.136 + <scope>test</scope>
3.137 + </dependency>
3.138 + <dependency>
3.139 + <groupId>com.sun.jersey</groupId>
3.140 + <artifactId>jersey-json</artifactId>
3.141 + <version>${jerseyVersion}</version>
3.142 + <type>jar</type>
3.143 + <exclusions>
3.144 + <exclusion>
3.145 + <artifactId>jaxb-api</artifactId>
3.146 + <groupId>javax.xml.bind</groupId>
3.147 + </exclusion>
3.148 + <exclusion>
3.149 + <artifactId>stax-api</artifactId>
3.150 + <groupId>stax</groupId>
3.151 + </exclusion>
3.152 + <exclusion>
3.153 + <artifactId>jersey-core</artifactId>
3.154 + <groupId>com.sun.jersey</groupId>
3.155 + </exclusion>
3.156 + </exclusions>
3.157 + </dependency>
3.158 + <dependency>
3.159 + <groupId>com.sun.jersey.jersey-test-framework</groupId>
3.160 + <artifactId>jersey-test-framework-http</artifactId>
3.161 + <version>${jerseyVersion}</version>
3.162 + <scope>test</scope>
3.163 + </dependency>
3.164 + <dependency>
3.165 + <groupId>${project.groupId}</groupId>
3.166 + <artifactId>wsdor</artifactId>
3.167 + <version>${wsdorVersion}</version>
3.168 + </dependency>
3.169 + </dependencies>
3.170 +
3.171 + <build>
3.172 + <plugins>
3.173 + <plugin>
3.174 + <groupId>org.apache.maven.plugins</groupId>
3.175 + <artifactId>maven-compiler-plugin</artifactId>
3.176 + <version>2.3.2</version>
3.177 + <configuration>
3.178 + <source>1.6</source>
3.179 + <target>1.6</target>
3.180 + <compilerArguments>
3.181 + <endorseddirs>${endorsed.dir}</endorseddirs>
3.182 + </compilerArguments>
3.183 + </configuration>
3.184 + </plugin>
3.185 + <plugin>
3.186 + <groupId>org.apache.maven.plugins</groupId>
3.187 + <artifactId>maven-war-plugin</artifactId>
3.188 + <version>2.1.1</version>
3.189 + <configuration>
3.190 + <failOnMissingWebXml>false</failOnMissingWebXml>
3.191 + </configuration>
3.192 + </plugin>
3.193 + <plugin>
3.194 + <groupId>org.apache.maven.plugins</groupId>
3.195 + <artifactId>maven-dependency-plugin</artifactId>
3.196 + <version>2.1</version>
3.197 + <executions>
3.198 + <execution>
3.199 + <phase>validate</phase>
3.200 + <goals>
3.201 + <goal>copy</goal>
3.202 + </goals>
3.203 + <configuration>
3.204 + <outputDirectory>${endorsed.dir}</outputDirectory>
3.205 + <silent>true</silent>
3.206 + <artifactItems>
3.207 + <artifactItem>
3.208 + <groupId>javax</groupId>
3.209 + <artifactId>javaee-endorsed-api</artifactId>
3.210 + <version>6.0</version>
3.211 + <type>jar</type>
3.212 + </artifactItem>
3.213 + </artifactItems>
3.214 + </configuration>
3.215 + </execution>
3.216 + </executions>
3.217 + </plugin>
3.218 + <plugin>
3.219 + <groupId>org.apache.maven.plugins</groupId>
3.220 + <artifactId>maven-surefire-plugin</artifactId>
3.221 + <version>2.9</version>
3.222 + <configuration>
3.223 + <skipTests>true</skipTests>
3.224 + </configuration>
3.225 + </plugin>
3.226 + </plugins>
3.227 + </build>
3.228 + <repositories>
3.229 + <repository>
3.230 + <url>http://download.java.net/maven/2/</url>
3.231 + <id>restlib</id>
3.232 + <layout>default</layout>
3.233 + <name>Repository for library Library[restlib]</name>
3.234 + </repository>
3.235 + </repositories>
3.236 </project>
3.237 -
3.238 -
3.239 -
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Application.java Sun Jul 17 15:40:50 2011 +0200
4.3 @@ -0,0 +1,15 @@
4.4 +/*
4.5 + * To change this template, choose Tools | Templates
4.6 + * and open the template in the editor.
4.7 + */
4.8 +package cz.xelfi.quoridor.webidor.resources;
4.9 +
4.10 +import javax.ws.rs.ApplicationPath;
4.11 +
4.12 +/**
4.13 + *
4.14 + * @author Jaroslav Tulach <jtulach@netbeans.org>
4.15 + */
4.16 +@ApplicationPath("resources")
4.17 +public class Application extends javax.ws.rs.core.Application {
4.18 +}
4.19 \ No newline at end of file
5.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java Sun May 01 21:10:07 2011 +0200
5.2 +++ b/webidor/src/main/java/cz/xelfi/quoridor/webidor/resources/Quoridor.java Sun Jul 17 15:40:50 2011 +0200
5.3 @@ -18,19 +18,16 @@
5.4
5.5 package cz.xelfi.quoridor.webidor.resources;
5.6
5.7 -import com.sun.jersey.api.container.grizzly2.GrizzlyServerFactory;
5.8 -import com.sun.jersey.api.core.PackagesResourceConfig;
5.9 -import com.sun.jersey.api.core.ResourceConfig;
5.10 import com.sun.jersey.api.json.JSONWithPadding;
5.11 -import com.sun.jersey.spi.resource.Singleton;
5.12 import java.io.File;
5.13 import java.io.FileInputStream;
5.14 import java.io.IOException;
5.15 -import java.net.ServerSocket;
5.16 import java.util.HashMap;
5.17 import java.util.Map;
5.18 import java.util.Properties;
5.19 import java.util.UUID;
5.20 +import javax.annotation.ManagedBean;
5.21 +import javax.inject.Singleton;
5.22 import javax.ws.rs.GET;
5.23 import javax.ws.rs.PUT;
5.24 import javax.ws.rs.Path;
5.25 @@ -39,7 +36,6 @@
5.26 import javax.ws.rs.WebApplicationException;
5.27 import javax.ws.rs.core.MediaType;
5.28 import javax.ws.rs.core.Response.Status;
5.29 -import org.glassfish.grizzly.http.server.HttpServer;
5.30
5.31 /**
5.32 *
5.33 @@ -47,16 +43,17 @@
5.34 */
5.35 @Path("/")
5.36 @Singleton
5.37 -public final class Quoridor {
5.38 +@ManagedBean
5.39 +public class Quoridor {
5.40 private final File path;
5.41 private Games games;
5.42 private Users users;
5.43 private final Map<UUID,String> loggedIn;
5.44
5.45 public Quoridor() {
5.46 - final String prop = System.getProperty("quoridor.dir"); // NOI18N
5.47 + String prop = System.getProperty("quoridor.dir"); // NOI18N
5.48 if (prop == null) {
5.49 - throw new IllegalStateException("quoridor.dir property must be specified"); // NOI18N
5.50 + prop = System.getProperty("user.dir") + File.separatorChar + ".quoridor"; // NOI18N
5.51 }
5.52 path = new File(prop);
5.53 path.mkdirs();
5.54 @@ -144,53 +141,4 @@
5.55 return getUsers().getUserInfo(callback, id, ret);
5.56 }
5.57 }
5.58 -
5.59 - //
5.60 - // start the server
5.61 - //
5.62 -
5.63 - public static void main(String[] args) throws IOException, InterruptedException {
5.64 - int port = 9222;
5.65 - try {
5.66 - port = Integer.parseInt(args[0]);
5.67 - } catch (Exception ex) {
5.68 - // OK
5.69 - }
5.70 - HttpServer s = start(port);
5.71 - System.out.println(
5.72 - "Quoridor started at port " + port + "\n" + "Hit enter to stop it..."
5.73 - );
5.74 - if (args.length < 2 || !args[args.length - 1].equals("--kill")) {
5.75 - System.out.println("Hit enter to stop it...");
5.76 - System.in.read();
5.77 - } else {
5.78 - synchronized (Quoridor.class) {
5.79 - Quoridor.class.wait();
5.80 - }
5.81 - }
5.82 - System.in.read();
5.83 - s.stop();
5.84 - System.exit(0);
5.85 - }
5.86 -
5.87 - public static HttpServer start(int port) throws IOException {
5.88 - if (port == -1) {
5.89 - ServerSocket ss = new ServerSocket(0);
5.90 - port =ss.getLocalPort();
5.91 - ss.close();
5.92 - }
5.93 - final String baseUri = "http://localhost:" + port + "/";
5.94 -
5.95 - if (System.getProperty("quoridor.dir") == null) {
5.96 - File home = new File(System.getProperty("user.home"));
5.97 - File quoridor = new File(home, ".quoridor");
5.98 - System.setProperty("quoridor.dir", quoridor.getPath());
5.99 - }
5.100 -
5.101 - ResourceConfig rc = new PackagesResourceConfig("cz.xelfi.quoridor.webidor");
5.102 - HttpServer server = GrizzlyServerFactory.createHttpServer(baseUri, rc);
5.103 - server.start();
5.104 - return server;
5.105 - }
5.106 -
5.107 }
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/webidor/src/main/webapp/WEB-INF/beans.xml Sun Jul 17 15:40:50 2011 +0200
6.3 @@ -0,0 +1,5 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<beans xmlns="http://java.sun.com/xml/ns/javaee"
6.6 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6.7 + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
6.8 +</beans>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/webidor/src/main/webapp/index.jsp Sun Jul 17 15:40:50 2011 +0200
7.3 @@ -0,0 +1,15 @@
7.4 +<%@page contentType="text/html" pageEncoding="UTF-8"%>
7.5 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
7.6 + "http://www.w3.org/TR/html4/loose.dtd">
7.7 +
7.8 +<html>
7.9 + <head>
7.10 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7.11 + <title>Quoridor REST APIs</title>
7.12 + </head>
7.13 + <body>
7.14 + <h1>Quoridor REST APIs!</h1>
7.15 +
7.16 + Get list of <a href="resources/games">all games</a>.
7.17 + </body>
7.18 +</html>
8.1 --- a/wsdor/pom.xml Sun May 01 21:10:07 2011 +0200
8.2 +++ b/wsdor/pom.xml Sun Jul 17 15:40:50 2011 +0200
8.3 @@ -63,16 +63,6 @@
8.4 </dependency>
8.5 <dependency>
8.6 <groupId>com.sun.jersey</groupId>
8.7 - <artifactId>jersey-core</artifactId>
8.8 - <version>${jerseyVersion}</version>
8.9 - </dependency>
8.10 - <dependency>
8.11 - <groupId>com.sun.jersey</groupId>
8.12 - <artifactId>jersey-server</artifactId>
8.13 - <version>${jerseyVersion}</version>
8.14 - </dependency>
8.15 - <dependency>
8.16 - <groupId>com.sun.jersey</groupId>
8.17 <artifactId>jersey-json</artifactId>
8.18 <version>${jerseyVersion}</version>
8.19 <type>jar</type>
8.20 @@ -85,7 +75,17 @@
8.21 <artifactId>stax-api</artifactId>
8.22 <groupId>stax</groupId>
8.23 </exclusion>
8.24 + <exclusion>
8.25 + <artifactId>jersey-core</artifactId>
8.26 + <groupId>com.sun.jersey</groupId>
8.27 + </exclusion>
8.28 </exclusions>
8.29 </dependency>
8.30 + <dependency>
8.31 + <groupId>javax</groupId>
8.32 + <artifactId>javaee-web-api</artifactId>
8.33 + <version>6.0</version>
8.34 + <scope>provided</scope>
8.35 + </dependency>
8.36 </dependencies>
8.37 </project>