Neurogami-roir 1.3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. data/History.txt +22 -0
  2. data/Manifest.txt +250 -0
  3. data/README.md +12 -0
  4. data/Rakefile +63 -0
  5. data/bin/roir +176 -0
  6. data/data/GenericJavaApp.icns +0 -0
  7. data/data/JavaApplicationStub +0 -0
  8. data/data/Rawr logo 1 large.png +0 -0
  9. data/data/Rawr logo 2 large.png +0 -0
  10. data/data/Rawr logo2.png +0 -0
  11. data/data/website/_notes/dwsync.xml +1 -0
  12. data/data/website/css/1.css +254 -0
  13. data/data/website/css/_notes/dwsync.xml +1 -0
  14. data/data/website/images/_notes/dwsync.xml +1 -0
  15. data/data/website/images/body_bg.jpg +0 -0
  16. data/data/website/images/bullet.gif +0 -0
  17. data/data/website/images/content.jpg +0 -0
  18. data/data/website/images/content_h2.gif +0 -0
  19. data/data/website/images/details.gif +0 -0
  20. data/data/website/images/details.jpg +0 -0
  21. data/data/website/images/header_bg.jpg +0 -0
  22. data/data/website/images/nav_a_hover.gif +0 -0
  23. data/data/website/images/rawr_logo.png +0 -0
  24. data/data/website/index.html +164 -0
  25. data/lib/app_bundler.rb +138 -0
  26. data/lib/bundler.rb +36 -0
  27. data/lib/command.rb +68 -0
  28. data/lib/exe_bundler.rb +106 -0
  29. data/lib/generator.rb +127 -0
  30. data/lib/jar_builder.rb +57 -0
  31. data/lib/jruby_batch_compiler.rb +127 -0
  32. data/lib/jruby_release.rb +104 -0
  33. data/lib/launch4j/LICENSE.txt +30 -0
  34. data/lib/launch4j/bin-linux/COPYING +340 -0
  35. data/lib/launch4j/bin-linux/ld +0 -0
  36. data/lib/launch4j/bin-linux/windres +0 -0
  37. data/lib/launch4j/bin-mac/COPYING +340 -0
  38. data/lib/launch4j/bin-mac/ld +0 -0
  39. data/lib/launch4j/bin-mac/readme.txt +1 -0
  40. data/lib/launch4j/bin-mac/windres +0 -0
  41. data/lib/launch4j/bin-win/COPYING +340 -0
  42. data/lib/launch4j/bin-win/ld.exe +0 -0
  43. data/lib/launch4j/bin-win/windres.exe +0 -0
  44. data/lib/launch4j/build.xml +62 -0
  45. data/lib/launch4j/demo/ConsoleApp/ConsoleApp.jar +0 -0
  46. data/lib/launch4j/demo/ConsoleApp/build.xml +57 -0
  47. data/lib/launch4j/demo/ConsoleApp/l4j/ConsoleApp.ico +0 -0
  48. data/lib/launch4j/demo/ConsoleApp/lib/readme.txt +8 -0
  49. data/lib/launch4j/demo/ConsoleApp/readme.txt +1 -0
  50. data/lib/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java +72 -0
  51. data/lib/launch4j/demo/LICENSE.txt +30 -0
  52. data/lib/launch4j/demo/SimpleApp/SimpleApp.jar +0 -0
  53. data/lib/launch4j/demo/SimpleApp/build.xml +52 -0
  54. data/lib/launch4j/demo/SimpleApp/l4j/SimpleApp.ico +0 -0
  55. data/lib/launch4j/demo/SimpleApp/l4j/SimpleApp.xml +18 -0
  56. data/lib/launch4j/demo/SimpleApp/l4j/splash.bmp +0 -0
  57. data/lib/launch4j/demo/SimpleApp/lib/readme.txt +8 -0
  58. data/lib/launch4j/demo/SimpleApp/readme.txt +1 -0
  59. data/lib/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java +104 -0
  60. data/lib/launch4j/demo/readme.txt +3 -0
  61. data/lib/launch4j/head/LICENSE.txt +23 -0
  62. data/lib/launch4j/head/consolehead.o +0 -0
  63. data/lib/launch4j/head/guihead.o +0 -0
  64. data/lib/launch4j/head/head.o +0 -0
  65. data/lib/launch4j/head_src/LICENSE.txt +23 -0
  66. data/lib/launch4j/head_src/consolehead/Makefile.win +33 -0
  67. data/lib/launch4j/head_src/consolehead/consolehead.c +65 -0
  68. data/lib/launch4j/head_src/consolehead/consolehead.dev +108 -0
  69. data/lib/launch4j/head_src/guihead/Makefile.win +33 -0
  70. data/lib/launch4j/head_src/guihead/guihead.c +185 -0
  71. data/lib/launch4j/head_src/guihead/guihead.dev +109 -0
  72. data/lib/launch4j/head_src/guihead/guihead.h +43 -0
  73. data/lib/launch4j/head_src/head.c +807 -0
  74. data/lib/launch4j/head_src/head.h +113 -0
  75. data/lib/launch4j/head_src/resource.h +71 -0
  76. data/lib/launch4j/launch4j +8 -0
  77. data/lib/launch4j/launch4j.jar +0 -0
  78. data/lib/launch4j/launch4j.jfpr +0 -0
  79. data/lib/launch4j/lib/JGoodies.Forms.LICENSE.txt +31 -0
  80. data/lib/launch4j/lib/JGoodies.Looks.LICENSE.txt +31 -0
  81. data/lib/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt +504 -0
  82. data/lib/launch4j/lib/XStream.LICENSE.txt +27 -0
  83. data/lib/launch4j/lib/commons-beanutils.jar +0 -0
  84. data/lib/launch4j/lib/commons-logging.jar +0 -0
  85. data/lib/launch4j/lib/commons.LICENSE.txt +50 -0
  86. data/lib/launch4j/lib/forms.jar +0 -0
  87. data/lib/launch4j/lib/formsrt.jar +0 -0
  88. data/lib/launch4j/lib/foxtrot.LICENSE.txt +25 -0
  89. data/lib/launch4j/lib/foxtrot.jar +0 -0
  90. data/lib/launch4j/lib/looks.jar +0 -0
  91. data/lib/launch4j/lib/xstream.jar +0 -0
  92. data/lib/launch4j/manifest/uac.exe.manifest +12 -0
  93. data/lib/launch4j/manifest/xp-themes.exe.manifest +14 -0
  94. data/lib/launch4j/src/images/asterix-o.gif +0 -0
  95. data/lib/launch4j/src/images/asterix.gif +0 -0
  96. data/lib/launch4j/src/images/build.png +0 -0
  97. data/lib/launch4j/src/images/button_ok.png +0 -0
  98. data/lib/launch4j/src/images/cancel16.png +0 -0
  99. data/lib/launch4j/src/images/down16.png +0 -0
  100. data/lib/launch4j/src/images/edit_add16.png +0 -0
  101. data/lib/launch4j/src/images/info.png +0 -0
  102. data/lib/launch4j/src/images/new.png +0 -0
  103. data/lib/launch4j/src/images/new16.png +0 -0
  104. data/lib/launch4j/src/images/ok16.png +0 -0
  105. data/lib/launch4j/src/images/open.png +0 -0
  106. data/lib/launch4j/src/images/open16.png +0 -0
  107. data/lib/launch4j/src/images/run.png +0 -0
  108. data/lib/launch4j/src/images/save.png +0 -0
  109. data/lib/launch4j/src/images/up16.png +0 -0
  110. data/lib/launch4j/src/launch4j.properties +2 -0
  111. data/lib/launch4j/src/net/sf/launch4j/Builder.java +207 -0
  112. data/lib/launch4j/src/net/sf/launch4j/BuilderException.java +52 -0
  113. data/lib/launch4j/src/net/sf/launch4j/ExecException.java +66 -0
  114. data/lib/launch4j/src/net/sf/launch4j/FileChooserFilter.java +76 -0
  115. data/lib/launch4j/src/net/sf/launch4j/Log.java +105 -0
  116. data/lib/launch4j/src/net/sf/launch4j/Main.java +99 -0
  117. data/lib/launch4j/src/net/sf/launch4j/Messages.java +78 -0
  118. data/lib/launch4j/src/net/sf/launch4j/OptionParser.java +71 -0
  119. data/lib/launch4j/src/net/sf/launch4j/RcBuilder.java +340 -0
  120. data/lib/launch4j/src/net/sf/launch4j/Util.java +197 -0
  121. data/lib/launch4j/src/net/sf/launch4j/ant/AntClassPath.java +61 -0
  122. data/lib/launch4j/src/net/sf/launch4j/ant/AntConfig.java +129 -0
  123. data/lib/launch4j/src/net/sf/launch4j/ant/AntJre.java +69 -0
  124. data/lib/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java +162 -0
  125. data/lib/launch4j/src/net/sf/launch4j/ant/Messages.java +55 -0
  126. data/lib/launch4j/src/net/sf/launch4j/ant/StringWrapper.java +67 -0
  127. data/lib/launch4j/src/net/sf/launch4j/ant/messages.properties +35 -0
  128. data/lib/launch4j/src/net/sf/launch4j/ant/messages_es.properties +35 -0
  129. data/lib/launch4j/src/net/sf/launch4j/binding/Binding.java +62 -0
  130. data/lib/launch4j/src/net/sf/launch4j/binding/BindingException.java +52 -0
  131. data/lib/launch4j/src/net/sf/launch4j/binding/Bindings.java +317 -0
  132. data/lib/launch4j/src/net/sf/launch4j/binding/IValidatable.java +44 -0
  133. data/lib/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java +67 -0
  134. data/lib/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java +119 -0
  135. data/lib/launch4j/src/net/sf/launch4j/binding/JListBinding.java +118 -0
  136. data/lib/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java +146 -0
  137. data/lib/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java +123 -0
  138. data/lib/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java +108 -0
  139. data/lib/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java +108 -0
  140. data/lib/launch4j/src/net/sf/launch4j/binding/Messages.java +78 -0
  141. data/lib/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java +119 -0
  142. data/lib/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java +141 -0
  143. data/lib/launch4j/src/net/sf/launch4j/binding/Validator.java +259 -0
  144. data/lib/launch4j/src/net/sf/launch4j/binding/messages.properties +52 -0
  145. data/lib/launch4j/src/net/sf/launch4j/binding/messages_es.properties +51 -0
  146. data/lib/launch4j/src/net/sf/launch4j/config/ClassPath.java +87 -0
  147. data/lib/launch4j/src/net/sf/launch4j/config/Config.java +396 -0
  148. data/lib/launch4j/src/net/sf/launch4j/config/ConfigPersister.java +249 -0
  149. data/lib/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java +51 -0
  150. data/lib/launch4j/src/net/sf/launch4j/config/Jre.java +235 -0
  151. data/lib/launch4j/src/net/sf/launch4j/config/LdDefaults.java +62 -0
  152. data/lib/launch4j/src/net/sf/launch4j/config/Messages.java +78 -0
  153. data/lib/launch4j/src/net/sf/launch4j/config/Msg.java +111 -0
  154. data/lib/launch4j/src/net/sf/launch4j/config/SingleInstance.java +74 -0
  155. data/lib/launch4j/src/net/sf/launch4j/config/Splash.java +103 -0
  156. data/lib/launch4j/src/net/sf/launch4j/config/VersionInfo.java +168 -0
  157. data/lib/launch4j/src/net/sf/launch4j/config/messages.properties +93 -0
  158. data/lib/launch4j/src/net/sf/launch4j/config/messages_es.properties +75 -0
  159. data/lib/launch4j/src/net/sf/launch4j/form/BasicForm.java +283 -0
  160. data/lib/launch4j/src/net/sf/launch4j/form/BasicForm.jfrm +0 -0
  161. data/lib/launch4j/src/net/sf/launch4j/form/ClassPathForm.java +193 -0
  162. data/lib/launch4j/src/net/sf/launch4j/form/ClassPathForm.jfrm +0 -0
  163. data/lib/launch4j/src/net/sf/launch4j/form/ConfigForm.java +132 -0
  164. data/lib/launch4j/src/net/sf/launch4j/form/ConfigForm.jfrm +0 -0
  165. data/lib/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java +127 -0
  166. data/lib/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.jfrm +0 -0
  167. data/lib/launch4j/src/net/sf/launch4j/form/HeaderForm.java +171 -0
  168. data/lib/launch4j/src/net/sf/launch4j/form/HeaderForm.jfrm +0 -0
  169. data/lib/launch4j/src/net/sf/launch4j/form/JreForm.java +266 -0
  170. data/lib/launch4j/src/net/sf/launch4j/form/JreForm.jfrm +0 -0
  171. data/lib/launch4j/src/net/sf/launch4j/form/Messages.java +55 -0
  172. data/lib/launch4j/src/net/sf/launch4j/form/MessagesForm.java +183 -0
  173. data/lib/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm +0 -0
  174. data/lib/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java +141 -0
  175. data/lib/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.jfrm +0 -0
  176. data/lib/launch4j/src/net/sf/launch4j/form/SplashForm.java +166 -0
  177. data/lib/launch4j/src/net/sf/launch4j/form/SplashForm.jfrm +0 -0
  178. data/lib/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java +232 -0
  179. data/lib/launch4j/src/net/sf/launch4j/form/VersionInfoForm.jfrm +0 -0
  180. data/lib/launch4j/src/net/sf/launch4j/form/messages.properties +146 -0
  181. data/lib/launch4j/src/net/sf/launch4j/form/messages_es.properties +118 -0
  182. data/lib/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java +75 -0
  183. data/lib/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java +101 -0
  184. data/lib/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java +79 -0
  185. data/lib/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java +222 -0
  186. data/lib/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java +100 -0
  187. data/lib/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java +50 -0
  188. data/lib/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java +65 -0
  189. data/lib/launch4j/src/net/sf/launch4j/formimpl/GlassPane.java +67 -0
  190. data/lib/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java +102 -0
  191. data/lib/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java +166 -0
  192. data/lib/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java +358 -0
  193. data/lib/launch4j/src/net/sf/launch4j/formimpl/Messages.java +55 -0
  194. data/lib/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java +58 -0
  195. data/lib/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java +54 -0
  196. data/lib/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java +61 -0
  197. data/lib/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java +63 -0
  198. data/lib/launch4j/src/net/sf/launch4j/formimpl/messages.properties +74 -0
  199. data/lib/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties +56 -0
  200. data/lib/launch4j/src/net/sf/launch4j/messages.properties +45 -0
  201. data/lib/launch4j/src/net/sf/launch4j/messages_es.properties +45 -0
  202. data/lib/launch4j/w32api/MinGW.LICENSE.txt +25 -0
  203. data/lib/launch4j/w32api/crt2.o +0 -0
  204. data/lib/launch4j/w32api/libadvapi32.a +0 -0
  205. data/lib/launch4j/w32api/libgcc.a +0 -0
  206. data/lib/launch4j/w32api/libkernel32.a +0 -0
  207. data/lib/launch4j/w32api/libmingw32.a +0 -0
  208. data/lib/launch4j/w32api/libmsvcrt.a +0 -0
  209. data/lib/launch4j/w32api/libshell32.a +0 -0
  210. data/lib/launch4j/w32api/libuser32.a +0 -0
  211. data/lib/launch4j/web/bullet.gif +0 -0
  212. data/lib/launch4j/web/changelog.html +356 -0
  213. data/lib/launch4j/web/docs.html +585 -0
  214. data/lib/launch4j/web/index.html +128 -0
  215. data/lib/launch4j/web/launch4j-use.gif +0 -0
  216. data/lib/launch4j/web/launch4j.gif +0 -0
  217. data/lib/launch4j/web/links.html +73 -0
  218. data/lib/launch4j/web/style.css +159 -0
  219. data/lib/options.rb +101 -0
  220. data/lib/platform.rb +28 -0
  221. data/lib/rawr.rb +178 -0
  222. data/lib/rawr_bundle.rb +26 -0
  223. data/lib/rawr_version.rb +3 -0
  224. data/lib/web_bundler.rb +114 -0
  225. data/lib/zip/ioextras.rb +155 -0
  226. data/lib/zip/stdrubyext.rb +111 -0
  227. data/lib/zip/tempfile_bugfixed.rb +195 -0
  228. data/lib/zip/zip.rb +1848 -0
  229. data/lib/zip/zipfilesystem.rb +609 -0
  230. data/lib/zip/ziprequire.rb +90 -0
  231. data/tasks/ann.rake +81 -0
  232. data/tasks/bones.rake +21 -0
  233. data/tasks/gem.rake +121 -0
  234. data/tasks/manifest.rake +49 -0
  235. data/tasks/notes.rake +28 -0
  236. data/tasks/post_load.rake +39 -0
  237. data/tasks/rdoc.rake +51 -0
  238. data/tasks/rubyforge.rake +57 -0
  239. data/tasks/setup.rb +269 -0
  240. data/tasks/spec.rake +63 -0
  241. data/tasks/svn.rake +48 -0
  242. data/tasks/test.rake +38 -0
  243. data/test/unit/app_bundler_spec.rb +65 -0
  244. data/test/unit/bundler_spec.rb +27 -0
  245. data/test/unit/generator_spec.rb +49 -0
  246. data/test/unit/jar_builder_spec.rb +5 -0
  247. data/test/unit/options_spec.rb +97 -0
  248. data/test/unit/platform_spec.rb +29 -0
  249. data/test/unit/spec_helpers.rb +22 -0
  250. data/test/unit/web_bundler_spec.rb +83 -0
  251. metadata +501 -0
@@ -0,0 +1,249 @@
1
+ /*
2
+ Launch4j (http://launch4j.sourceforge.net/)
3
+ Cross-platform Java application wrapper for creating Windows native executables.
4
+
5
+ Copyright (c) 2004, 2007 Grzegorz Kowal
6
+
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without modification,
10
+ are permitted provided that the following conditions are met:
11
+
12
+ * Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimer.
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+ * Neither the name of the Launch4j nor the names of its contributors
18
+ may be used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+
34
+ /*
35
+ * Created on Apr 22, 2005
36
+ */
37
+ package net.sf.launch4j.config;
38
+
39
+ import java.io.BufferedWriter;
40
+ import java.io.File;
41
+ import java.io.FileInputStream;
42
+ import java.io.FileReader;
43
+ import java.io.FileWriter;
44
+ import java.io.IOException;
45
+ import java.util.ArrayList;
46
+ import java.util.List;
47
+ import java.util.Properties;
48
+
49
+ import net.sf.launch4j.Util;
50
+
51
+ import com.thoughtworks.xstream.XStream;
52
+ import com.thoughtworks.xstream.io.xml.DomDriver;
53
+
54
+ /**
55
+ * @author Copyright (C) 2005 Grzegorz Kowal
56
+ */
57
+ public class ConfigPersister {
58
+
59
+ private static final ConfigPersister _instance = new ConfigPersister();
60
+
61
+ private final XStream _xstream;
62
+ private Config _config;
63
+ private File _configPath;
64
+
65
+ private ConfigPersister() {
66
+ _xstream = new XStream(new DomDriver());
67
+ _xstream.alias("launch4jConfig", Config.class);
68
+ _xstream.alias("classPath", ClassPath.class);
69
+ _xstream.alias("jre", Jre.class);
70
+ _xstream.alias("splash", Splash.class);
71
+ _xstream.alias("versionInfo", VersionInfo.class);
72
+
73
+ _xstream.addImplicitCollection(Config.class, "headerObjects", "obj",
74
+ String.class);
75
+ _xstream.addImplicitCollection(Config.class, "libs", "lib", String.class);
76
+ _xstream.addImplicitCollection(Config.class, "variables", "var", String.class);
77
+ _xstream.addImplicitCollection(ClassPath.class, "paths", "cp", String.class);
78
+ _xstream.addImplicitCollection(Jre.class, "options", "opt", String.class);
79
+ }
80
+
81
+ public static ConfigPersister getInstance() {
82
+ return _instance;
83
+ }
84
+
85
+ public Config getConfig() {
86
+ return _config;
87
+ }
88
+
89
+ public File getConfigPath() {
90
+ return _configPath;
91
+ }
92
+
93
+ public File getOutputPath() throws IOException {
94
+ if (_config.getOutfile().isAbsolute()) {
95
+ return _config.getOutfile().getParentFile();
96
+ }
97
+ File parent = _config.getOutfile().getParentFile();
98
+ return (parent != null) ? new File(_configPath, parent.getPath()) : _configPath;
99
+ }
100
+
101
+ public File getOutputFile() throws IOException {
102
+ return _config.getOutfile().isAbsolute()
103
+ ? _config.getOutfile()
104
+ : new File(getOutputPath(), _config.getOutfile().getName());
105
+ }
106
+
107
+ public void createBlank() {
108
+ _config = new Config();
109
+ _config.setJre(new Jre());
110
+ _configPath = null;
111
+ }
112
+
113
+ public void setAntConfig(Config c, File basedir) {
114
+ _config = c;
115
+ _configPath = basedir;
116
+ }
117
+
118
+ public void load(File f) throws ConfigPersisterException {
119
+ try {
120
+ FileReader r = new FileReader(f);
121
+ char[] buf = new char[(int) f.length()];
122
+ r.read(buf);
123
+ r.close();
124
+ // Convert 2.x config to 3.x
125
+ String s = String.valueOf(buf)
126
+ .replaceAll("<headerType>0<", "<headerType>gui<")
127
+ .replaceAll("<headerType>1<", "<headerType>console<")
128
+ .replaceAll("jarArgs>", "cmdLine>")
129
+ .replaceAll("<jarArgs[ ]*/>", "<cmdLine/>")
130
+ .replaceAll("args>", "opt>")
131
+ .replaceAll("<args[ ]*/>", "<opt/>")
132
+ .replaceAll("<dontUsePrivateJres>false</dontUsePrivateJres>",
133
+ "<jdkPreference>" + Jre.JDK_PREFERENCE_PREFER_JRE + "</jdkPreference>")
134
+ .replaceAll("<dontUsePrivateJres>true</dontUsePrivateJres>",
135
+ "<jdkPreference>" + Jre.JDK_PREFERENCE_JRE_ONLY + "</jdkPreference>")
136
+ .replaceAll("<initialHeapSize>0</initialHeapSize>", "")
137
+ .replaceAll("<maxHeapSize>0</maxHeapSize>", "");
138
+ _config = (Config) _xstream.fromXML(s);
139
+ setConfigPath(f);
140
+ } catch (Exception e) {
141
+ throw new ConfigPersisterException(e);
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Imports launch4j 1.x.x config file.
147
+ */
148
+ public void loadVersion1(File f) throws ConfigPersisterException {
149
+ try {
150
+ Props props = new Props(f);
151
+ _config = new Config();
152
+ String header = props.getProperty(Config.HEADER);
153
+ _config.setHeaderType(header == null
154
+ || header.toLowerCase().equals("guihead.bin") ? Config.GUI_HEADER
155
+ : Config.CONSOLE_HEADER);
156
+ _config.setJar(props.getFile(Config.JAR));
157
+ _config.setOutfile(props.getFile(Config.OUTFILE));
158
+ _config.setJre(new Jre());
159
+ _config.getJre().setPath(props.getProperty(Jre.PATH));
160
+ _config.getJre().setMinVersion(props.getProperty(Jre.MIN_VERSION));
161
+ _config.getJre().setMaxVersion(props.getProperty(Jre.MAX_VERSION));
162
+ String args = props.getProperty(Jre.ARGS);
163
+ if (args != null) {
164
+ List jreOptions = new ArrayList();
165
+ jreOptions.add(args);
166
+ _config.getJre().setOptions(jreOptions);
167
+ }
168
+ _config.setCmdLine(props.getProperty(Config.JAR_ARGS));
169
+ _config.setChdir("true".equals(props.getProperty(Config.CHDIR))
170
+ ? "." : null);
171
+ _config.setCustomProcName("true".equals(
172
+ props.getProperty("setProcName"))); // 1.x
173
+ _config.setStayAlive("true".equals(props.getProperty(Config.STAY_ALIVE)));
174
+ _config.setErrTitle(props.getProperty(Config.ERR_TITLE));
175
+ _config.setIcon(props.getFile(Config.ICON));
176
+ File splashFile = props.getFile(Splash.SPLASH_FILE);
177
+ if (splashFile != null) {
178
+ _config.setSplash(new Splash());
179
+ _config.getSplash().setFile(splashFile);
180
+ String waitfor = props.getProperty("waitfor"); // 1.x
181
+ _config.getSplash().setWaitForWindow(waitfor != null
182
+ && !waitfor.equals(""));
183
+ String splashTimeout = props.getProperty(Splash.TIMEOUT);
184
+ if (splashTimeout != null) {
185
+ _config.getSplash().setTimeout(Integer.parseInt(splashTimeout));
186
+ }
187
+ _config.getSplash().setTimeoutErr("true".equals(
188
+ props.getProperty(Splash.TIMEOUT_ERR)));
189
+ } else {
190
+ _config.setSplash(null);
191
+ }
192
+ setConfigPath(f);
193
+ } catch (IOException e) {
194
+ throw new ConfigPersisterException(e);
195
+ }
196
+ }
197
+
198
+ public void save(File f) throws ConfigPersisterException {
199
+ try {
200
+ BufferedWriter w = new BufferedWriter(new FileWriter(f));
201
+ _xstream.toXML(_config, w);
202
+ w.close();
203
+ setConfigPath(f);
204
+ } catch (Exception e) {
205
+ throw new ConfigPersisterException(e);
206
+ }
207
+ }
208
+
209
+ private void setConfigPath(File configFile) {
210
+ _configPath = configFile.getAbsoluteFile().getParentFile();
211
+ }
212
+
213
+ private class Props {
214
+ final Properties _properties = new Properties();
215
+
216
+ public Props(File f) throws IOException {
217
+ FileInputStream is = null;
218
+ try {
219
+ is = new FileInputStream(f);
220
+ _properties.load(is);
221
+ } finally {
222
+ Util.close(is);
223
+ }
224
+ }
225
+
226
+ /**
227
+ * Get property and remove trailing # comments.
228
+ */
229
+ public String getProperty(String key) {
230
+ String p = _properties.getProperty(key);
231
+ if (p == null) {
232
+ return null;
233
+ }
234
+ int x = p.indexOf('#');
235
+ if (x == -1) {
236
+ return p;
237
+ }
238
+ do {
239
+ x--;
240
+ } while (x > 0 && (p.charAt(x) == ' ' || p.charAt(x) == '\t'));
241
+ return (x == 0) ? "" : p.substring(0, x + 1);
242
+ }
243
+
244
+ public File getFile(String key) {
245
+ String value = getProperty(key);
246
+ return value != null ? new File(value) : null;
247
+ }
248
+ }
249
+ }
@@ -0,0 +1,51 @@
1
+ /*
2
+ Launch4j (http://launch4j.sourceforge.net/)
3
+ Cross-platform Java application wrapper for creating Windows native executables.
4
+
5
+ Copyright (c) 2004, 2007 Grzegorz Kowal
6
+
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without modification,
10
+ are permitted provided that the following conditions are met:
11
+
12
+ * Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimer.
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+ * Neither the name of the Launch4j nor the names of its contributors
18
+ may be used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+
34
+ /*
35
+ * Created on Apr 22, 2005
36
+ */
37
+ package net.sf.launch4j.config;
38
+
39
+ /**
40
+ * @author Copyright (C) 2005 Grzegorz Kowal
41
+ */
42
+ public class ConfigPersisterException extends Exception {
43
+
44
+ public ConfigPersisterException(String msg, Throwable t) {
45
+ super(msg, t);
46
+ }
47
+
48
+ public ConfigPersisterException(Throwable t) {
49
+ super(t);
50
+ }
51
+ }
@@ -0,0 +1,235 @@
1
+ /*
2
+ Launch4j (http://launch4j.sourceforge.net/)
3
+ Cross-platform Java application wrapper for creating Windows native executables.
4
+
5
+ Copyright (c) 2004, 2007 Grzegorz Kowal
6
+
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without modification,
10
+ are permitted provided that the following conditions are met:
11
+
12
+ * Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimer.
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+ * Neither the name of the Launch4j nor the names of its contributors
18
+ may be used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+
34
+ /*
35
+ * Created on Apr 21, 2005
36
+ */
37
+ package net.sf.launch4j.config;
38
+
39
+ import java.util.Arrays;
40
+ import java.util.List;
41
+
42
+ import net.sf.launch4j.binding.IValidatable;
43
+ import net.sf.launch4j.binding.Validator;
44
+
45
+ /**
46
+ * @author Copyright (C) 2005 Grzegorz Kowal
47
+ */
48
+ public class Jre implements IValidatable {
49
+
50
+ // 1.x config properties_____________________________________________________________
51
+ public static final String PATH = "jrepath";
52
+ public static final String MIN_VERSION = "javamin";
53
+ public static final String MAX_VERSION = "javamax";
54
+ public static final String ARGS = "jvmArgs";
55
+
56
+ // __________________________________________________________________________________
57
+ public static final String VERSION_PATTERN = "(\\d\\.){2}\\d(_\\d+)?";
58
+
59
+ public static final String JDK_PREFERENCE_JRE_ONLY = "jreOnly";
60
+ public static final String JDK_PREFERENCE_PREFER_JRE = "preferJre";
61
+ public static final String JDK_PREFERENCE_PREFER_JDK = "preferJdk";
62
+ public static final String JDK_PREFERENCE_JDK_ONLY = "jdkOnly";
63
+
64
+ private static final String[] JDK_PREFERENCE_NAMES = new String[] {
65
+ JDK_PREFERENCE_JRE_ONLY,
66
+ JDK_PREFERENCE_PREFER_JRE,
67
+ JDK_PREFERENCE_PREFER_JDK,
68
+ JDK_PREFERENCE_JDK_ONLY };
69
+
70
+ public static final int DEFAULT_JDK_PREFERENCE_INDEX
71
+ = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(JDK_PREFERENCE_PREFER_JRE);
72
+
73
+ private String path;
74
+ private String minVersion;
75
+ private String maxVersion;
76
+ private String jdkPreference;
77
+ private Integer initialHeapSize;
78
+ private Integer initialHeapPercent;
79
+ private Integer maxHeapSize;
80
+ private Integer maxHeapPercent;
81
+ private List options;
82
+
83
+ public void checkInvariants() {
84
+ Validator.checkOptString(minVersion, 10, VERSION_PATTERN,
85
+ "jre.minVersion", Messages.getString("Jre.min.version"));
86
+ Validator.checkOptString(maxVersion, 10, VERSION_PATTERN,
87
+ "jre.maxVersion", Messages.getString("Jre.max.version"));
88
+ if (Validator.isEmpty(path)) {
89
+ Validator.checkFalse(Validator.isEmpty(minVersion),
90
+ "jre.minVersion", Messages.getString("Jre.specify.jre.min.version.or.path"));
91
+ } else {
92
+ Validator.checkString(path, Validator.MAX_PATH,
93
+ "jre.path", Messages.getString("Jre.bundled.path"));
94
+ }
95
+ if (!Validator.isEmpty(maxVersion)) {
96
+ Validator.checkFalse(Validator.isEmpty(minVersion),
97
+ "jre.minVersion", Messages.getString("Jre.specify.min.version"));
98
+ Validator.checkTrue(minVersion.compareTo(maxVersion) < 0,
99
+ "jre.maxVersion", Messages.getString("Jre.max.greater.than.min"));
100
+ }
101
+ Validator.checkTrue(initialHeapSize == null || maxHeapSize != null,
102
+ "jre.maxHeapSize", Messages.getString("Jre.initial.and.max.heap"));
103
+ Validator.checkTrue(initialHeapSize == null || initialHeapSize.intValue() > 0,
104
+ "jre.initialHeapSize", Messages.getString("Jre.initial.heap"));
105
+ Validator.checkTrue(maxHeapSize == null || (maxHeapSize.intValue()
106
+ >= ((initialHeapSize != null) ? initialHeapSize.intValue() : 1)),
107
+ "jre.maxHeapSize", Messages.getString("Jre.max.heap"));
108
+ Validator.checkTrue(initialHeapPercent == null || maxHeapPercent != null,
109
+ "jre.maxHeapPercent", Messages.getString("Jre.initial.and.max.heap"));
110
+ if (initialHeapPercent != null) {
111
+ Validator.checkRange(initialHeapPercent.intValue(), 1, 100,
112
+ "jre.initialHeapPercent",
113
+ Messages.getString("Jre.initial.heap.percent"));
114
+ }
115
+ if (maxHeapPercent != null) {
116
+ Validator.checkRange(maxHeapPercent.intValue(),
117
+ initialHeapPercent != null ? initialHeapPercent.intValue() : 1, 100,
118
+ "jre.maxHeapPercent",
119
+ Messages.getString("Jre.max.heap.percent"));
120
+ }
121
+ Validator.checkIn(getJdkPreference(), JDK_PREFERENCE_NAMES,
122
+ "jre.jdkPreference", Messages.getString("Jre.jdkPreference.invalid"));
123
+ Validator.checkOptStrings(options,
124
+ Validator.MAX_ARGS,
125
+ Validator.MAX_ARGS,
126
+ "[^\"]*|([^\"]*\"[^\"]*\"[^\"]*)*",
127
+ "jre.options",
128
+ Messages.getString("Jre.jvm.options"),
129
+ Messages.getString("Jre.jvm.options.unclosed.quotation"));
130
+
131
+ // Quoted variable references: "[^%]*|([^%]*\"([^%]*%[^%]+%[^%]*)+\"[^%]*)*"
132
+ Validator.checkOptStrings(options,
133
+ Validator.MAX_ARGS,
134
+ Validator.MAX_ARGS,
135
+ "[^%]*|([^%]*([^%]*%[^%]+%[^%]*)+[^%]*)*",
136
+ "jre.options",
137
+ Messages.getString("Jre.jvm.options"),
138
+ Messages.getString("Jre.jvm.options.variable"));
139
+ }
140
+
141
+ /** JVM options */
142
+ public List getOptions() {
143
+ return options;
144
+ }
145
+
146
+ public void setOptions(List options) {
147
+ this.options = options;
148
+ }
149
+
150
+ /** Max Java version (x.x.x) */
151
+ public String getMaxVersion() {
152
+ return maxVersion;
153
+ }
154
+
155
+ public void setMaxVersion(String maxVersion) {
156
+ this.maxVersion = maxVersion;
157
+ }
158
+
159
+ /** Min Java version (x.x.x) */
160
+ public String getMinVersion() {
161
+ return minVersion;
162
+ }
163
+
164
+ public void setMinVersion(String minVersion) {
165
+ this.minVersion = minVersion;
166
+ }
167
+
168
+ /** Preference for standalone JRE or JDK-private JRE */
169
+ public String getJdkPreference() {
170
+ return Validator.isEmpty(jdkPreference) ? JDK_PREFERENCE_PREFER_JRE
171
+ : jdkPreference;
172
+ }
173
+
174
+ public void setJdkPreference(String jdkPreference) {
175
+ this.jdkPreference = jdkPreference;
176
+ }
177
+
178
+ /** Preference for standalone JRE or JDK-private JRE */
179
+ public int getJdkPreferenceIndex() {
180
+ int x = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(getJdkPreference());
181
+ return x != -1 ? x : DEFAULT_JDK_PREFERENCE_INDEX;
182
+ }
183
+
184
+ public void setJdkPreferenceIndex(int x) {
185
+ jdkPreference = JDK_PREFERENCE_NAMES[x];
186
+ }
187
+
188
+ /** JRE path */
189
+ public String getPath() {
190
+ return path;
191
+ }
192
+
193
+ public void setPath(String path) {
194
+ this.path = path;
195
+ }
196
+
197
+ /** Initial heap size in MB */
198
+ public Integer getInitialHeapSize() {
199
+ return initialHeapSize;
200
+ }
201
+
202
+ public void setInitialHeapSize(Integer initialHeapSize) {
203
+ this.initialHeapSize = getInteger(initialHeapSize);
204
+ }
205
+
206
+ /** Max heap size in MB */
207
+ public Integer getMaxHeapSize() {
208
+ return maxHeapSize;
209
+ }
210
+
211
+ public void setMaxHeapSize(Integer maxHeapSize) {
212
+ this.maxHeapSize = getInteger(maxHeapSize);
213
+ }
214
+
215
+ public Integer getInitialHeapPercent() {
216
+ return initialHeapPercent;
217
+ }
218
+
219
+ public void setInitialHeapPercent(Integer initialHeapPercent) {
220
+ this.initialHeapPercent = getInteger(initialHeapPercent);
221
+ }
222
+
223
+ public Integer getMaxHeapPercent() {
224
+ return maxHeapPercent;
225
+ }
226
+
227
+ public void setMaxHeapPercent(Integer maxHeapPercent) {
228
+ this.maxHeapPercent = getInteger(maxHeapPercent);
229
+ }
230
+
231
+ /** Convert 0 to null */
232
+ private Integer getInteger(Integer i) {
233
+ return i != null && i.intValue() == 0 ? null : i;
234
+ }
235
+ }
@@ -0,0 +1,62 @@
1
+ /*
2
+ Launch4j (http://launch4j.sourceforge.net/)
3
+ Cross-platform Java application wrapper for creating Windows native executables.
4
+
5
+ Copyright (c) 2004, 2007 Grzegorz Kowal
6
+
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without modification,
10
+ are permitted provided that the following conditions are met:
11
+
12
+ * Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimer.
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+ * Neither the name of the Launch4j nor the names of its contributors
18
+ may be used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+
34
+ /*
35
+ * Created on Sep 3, 2005
36
+ */
37
+ package net.sf.launch4j.config;
38
+
39
+ import java.util.Arrays;
40
+ import java.util.List;
41
+
42
+ public class LdDefaults {
43
+
44
+ public static final List GUI_HEADER_OBJECTS = Arrays.asList(new String[] {
45
+ "w32api/crt2.o",
46
+ "head/guihead.o",
47
+ "head/head.o" });
48
+
49
+ public static final List CONSOLE_HEADER_OBJECTS = Arrays.asList(new String[] {
50
+ "w32api/crt2.o",
51
+ "head/consolehead.o",
52
+ "head/head.o"});
53
+
54
+ public static final List LIBS = Arrays.asList(new String[] {
55
+ "w32api/libmingw32.a",
56
+ "w32api/libgcc.a",
57
+ "w32api/libmsvcrt.a",
58
+ "w32api/libkernel32.a",
59
+ "w32api/libuser32.a",
60
+ "w32api/libadvapi32.a",
61
+ "w32api/libshell32.a" });
62
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ Launch4j (http://launch4j.sourceforge.net/)
3
+ Cross-platform Java application wrapper for creating Windows native executables.
4
+
5
+ Copyright (c) 2004, 2007 Grzegorz Kowal
6
+
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without modification,
10
+ are permitted provided that the following conditions are met:
11
+
12
+ * Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimer.
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+ * Neither the name of the Launch4j nor the names of its contributors
18
+ may be used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+
34
+ package net.sf.launch4j.config;
35
+
36
+ import java.text.MessageFormat;
37
+ import java.util.MissingResourceException;
38
+ import java.util.ResourceBundle;
39
+
40
+ public class Messages {
41
+ private static final String BUNDLE_NAME = "net.sf.launch4j.config.messages";
42
+
43
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
44
+ .getBundle(BUNDLE_NAME);
45
+ private static final MessageFormat FORMATTER = new MessageFormat("");
46
+
47
+ private Messages() {
48
+ }
49
+
50
+ public static String getString(String key) {
51
+ try {
52
+ return RESOURCE_BUNDLE.getString(key);
53
+ } catch (MissingResourceException e) {
54
+ return '!' + key + '!';
55
+ }
56
+ }
57
+
58
+ public static String getString(String key, String arg0) {
59
+ return getString(key, new Object[] {arg0});
60
+ }
61
+
62
+ public static String getString(String key, String arg0, String arg1) {
63
+ return getString(key, new Object[] {arg0, arg1});
64
+ }
65
+
66
+ public static String getString(String key, String arg0, String arg1, String arg2) {
67
+ return getString(key, new Object[] {arg0, arg1, arg2});
68
+ }
69
+
70
+ public static String getString(String key, Object[] args) {
71
+ try {
72
+ FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key));
73
+ return FORMATTER.format(args);
74
+ } catch (MissingResourceException e) {
75
+ return '!' + key + '!';
76
+ }
77
+ }
78
+ }