JAL-3353 Change to build.gradle to use the file:// enabled getdown-launcher-local...
[jalview.git] / getdown / src / getdown / core / src / main / java / com / threerings / getdown / data / Build.java.tmpl
1 //
2 // Getdown - application installer, patcher and launcher
3 // Copyright (C) 2004-2016 Getdown authors
4 // https://github.com/threerings/getdown/blob/master/LICENSE
5
6 package com.threerings.getdown.data;
7
8 import java.util.Arrays;
9 import java.util.List;
10
11 import com.threerings.getdown.util.StringUtil;
12
13 /**
14  * Contains static data provided during the build process.
15  */
16 public class Build {
17
18     /** The date and time at which the code was built: in {@code yyyy-MM-dd HH:mm} format. */
19     public static String time () {
20         return "@build_time@";
21     }
22
23     /** The Maven version of the Getdown project. */
24     public static String version () {
25         return "@build_version@";
26     }
27
28     /**
29      * <p>The hosts which Getdown is allowed to communicate with. An empty list indicates that
30      * no whitelist is configured and there are no limitations. By default, no host whitelist
31      * is added to the binary, so it can be used to download and run applications from any
32      * server.
33      *
34      * <p>To create a custom Getdown build that can only talk to whitelisted servers, set
35      * the {@code getdown.host.whitelist} property on the command line while building the JAR
36      * (e.g. {@code mvn package -Dgetdown.host.whitelist=my.server.com}). Wildcards can be used
37      * (e.g. {@code *.mycompany.com}) and multiple values can be separated by commas
38      * (e.g. {@code app1.foo.com,app2.bar.com,app3.baz.com}).
39      */
40     public static List<String> hostWhitelist () {
41         return Arrays.asList(StringUtil.parseStringArray("@host_whitelist@"));
42     }
43     
44     /*
45      * <p>The default connect_timeout to use.  Overridden by system property of the same name at runtime
46      */
47     public static int defaultConnectTimeout () {
48         try {
49                         return Integer.valueOf("@connect_timeout@");
50                 } catch (Exception e) {
51                         return 0;
52                 }
53     }
54     
55     /*
56      * <p>The default read_timeout to use.  Overridden by system property of the same name at runtime
57      */
58     public static int defaultReadTimeout () {
59         try {
60                         return Integer.valueOf("@read_timeout@");
61                 } catch (Exception e) {
62                         return 30;
63                 }
64     }
65     
66     /*
67      * <p>Whether to allow the local "file://" scheme for appbase
68      */
69     public static boolean allowLocatorFileProtocol() {
70         try {
71                         return Boolean.valueOf("@allow_file_protocol@");
72                 } catch (Exception e) {
73                         return false;
74                 }
75     }
76 }