Adding identification of version
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 15 Sep 2009 07:32:17 +0200
changeset 88a3be2be0112f
parent 87 96f80f14cfcd
child 89 27a6cadb2000
Adding identification of version
freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt
freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.fmt
     1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Mon Sep 14 19:00:55 2009 +0200
     1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Tue Sep 15 07:32:17 2009 +0200
     1.3 @@ -35,11 +35,14 @@
     1.4  import com.sun.jersey.api.view.Viewable;
     1.5  import com.sun.net.httpserver.HttpServer;
     1.6  import java.io.File;
     1.7 +import java.io.IOException;
     1.8 +import java.io.InputStream;
     1.9  import java.net.URI;
    1.10  import java.util.HashMap;
    1.11  import java.util.Locale;
    1.12  import java.util.Map;
    1.13  import java.util.MissingResourceException;
    1.14 +import java.util.Properties;
    1.15  import java.util.ResourceBundle;
    1.16  import java.util.concurrent.Callable;
    1.17  import javax.ws.rs.DefaultValue;
    1.18 @@ -63,6 +66,19 @@
    1.19   */
    1.20  @Path("/")
    1.21  public final class UI {
    1.22 +    private static final String version;
    1.23 +    static {
    1.24 +        Properties p = new Properties();
    1.25 +        try {
    1.26 +            InputStream is = FreemarkerProcessor.class.getResourceAsStream("/META-INF/maven/org.apidesign/freemarkerdor/pom.properties"); // NOI18N
    1.27 +            if (is != null) {
    1.28 +                p.load(is);
    1.29 +            }
    1.30 +        } catch (IOException ex) {
    1.31 +            ex.printStackTrace();
    1.32 +        }
    1.33 +        version = p.getProperty("version", "unknown"); // NOI18N
    1.34 +    }
    1.35      private static WebResource base;
    1.36  
    1.37      @Context
    1.38 @@ -274,6 +290,7 @@
    1.39          map.put("user", user);
    1.40          map.put("bundle", rb);
    1.41          map.put("now", System.currentTimeMillis());
    1.42 +        map.put("version", version);
    1.43          for (int i = 0; i < more.length; i += 2) {
    1.44              map.put((String)more[i],more[i + 1]);
    1.45          }
     2.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties	Mon Sep 14 19:00:55 2009 +0200
     2.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties	Tue Sep 15 07:32:17 2009 +0200
     2.3 @@ -1,5 +1,5 @@
     2.4  TITLE=<a href="http://en.wikipedia.org/wiki/Quoridor">Quoridor</a> Community Server
     2.5 -
     2.6 +copyright=<a href="http://en.wikipedia.org/wiki/Quoridor">Quoridor</a> Community Server, Version {0}, (c) Jaroslav Tulach 2009
     2.7  
     2.8  gameWhiteBlack={0} vs. {1}
     2.9  LastMove=Last move {1,choice,\
     3.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties	Mon Sep 14 19:00:55 2009 +0200
     3.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties	Tue Sep 15 07:32:17 2009 +0200
     3.3 @@ -1,4 +1,5 @@
     3.4  TITLE=Komunitn\u00ED server <a href="http://cs.wikipedia.org/wiki/Quoridor">Quoridor</a>
     3.5 +copyright=Komunitn\u00ED server <a href="http://cs.wikipedia.org/wiki/Quoridor">Quoridor</a>, Verze {0}, napsal Jaroslav Tulach roku 2009
     3.6  gameWhiteBlack={0} proti {1}
     3.7  GAME_MOVE=Na tahu
     3.8  GAME_WAIT=\u010Cek\u00E1 se na tah
     4.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt	Mon Sep 14 19:00:55 2009 +0200
     4.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt	Tue Sep 15 07:32:17 2009 +0200
     4.3 @@ -109,5 +109,7 @@
     4.4                </#list>
     4.5            </tbody>
     4.6        </table>
     4.7 +      <hr/>
     4.8 +      ${bundle("copyright", version)}
     4.9    </body>
    4.10  </html>
    4.11 \ No newline at end of file
     5.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt	Mon Sep 14 19:00:55 2009 +0200
     5.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt	Tue Sep 15 07:32:17 2009 +0200
     5.3 @@ -100,5 +100,7 @@
     5.4          </li>
     5.5        </#list>
     5.6        </ol>
     5.7 +      <hr/>
     5.8 +      ${bundle("copyright", version)}
     5.9    </body>
    5.10  </html>
    5.11 \ No newline at end of file
     6.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.fmt	Mon Sep 14 19:00:55 2009 +0200
     6.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/login.fmt	Tue Sep 15 07:32:17 2009 +0200
     6.3 @@ -21,5 +21,7 @@
     6.4              <input type="submit" value="${bundle.LOGIN}"/>
     6.5        </form>
     6.6        </#if>
     6.7 +      <hr/>
     6.8 +      ${bundle("copyright", version)}
     6.9    </body>
    6.10  </html>
    6.11 \ No newline at end of file