modules/fxpackager/src/main/java/com/oracle/tools/packager/linux/LinuxAppBundler.java

Print this page
rev 6889 : RT-36724 - JavaFX Packager Renaming
Summary: Move java code around to new packages.


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.tools.packager.bundlers;
  27 
  28 import com.oracle.bundlers.AbstractBundler;
  29 import com.oracle.bundlers.BundlerParamInfo;
  30 import com.oracle.bundlers.JreUtils;
  31 import com.oracle.bundlers.JreUtils.Rule;
  32 import com.oracle.bundlers.StandardBundlerParam;
  33 import com.sun.javafx.tools.packager.Log;
  34 import com.sun.javafx.tools.resource.linux.LinuxResources;



  35 
  36 import java.io.File;
  37 import java.io.FileNotFoundException;
  38 import java.io.IOException;
  39 import java.io.PrintStream;
  40 import java.net.MalformedURLException;
  41 import java.net.URL;
  42 import java.text.MessageFormat;
  43 import java.util.*;
  44 
  45 import static com.oracle.bundlers.StandardBundlerParam.*;
  46 
  47 public class LinuxAppBundler extends AbstractBundler {
  48 
  49     private static final ResourceBundle I18N =
  50             ResourceBundle.getBundle("com.oracle.bundlers.linux.LinuxAppBundler");
  51     
  52     protected static final String LINUX_BUNDLER_PREFIX =
  53             BUNDLER_PREFIX + "linux" + File.separator;
  54     private static final String EXECUTABLE_NAME = "JavaAppLauncher";
  55 
  56     public static final BundlerParamInfo<File> ICON_PNG = new StandardBundlerParam<>(
  57             I18N.getString("param.icon-png.name"),
  58             I18N.getString("param.icon-png.description"),
  59             "icon.png",
  60             File.class,
  61             params -> {
  62                 File f = ICON.fetchFrom(params);
  63                 if (f != null && !f.getName().toLowerCase().endsWith(".png")) {
  64                     Log.info(MessageFormat.format(I18N.getString("message.icon-not-png"), f));
  65                     return null;
  66                 }
  67                 return f;
  68             },
  69             (s, p) -> new File(s));
  70 




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.oracle.tools.packager.linux;
  27 
  28 import com.oracle.tools.packager.AbstractBundler;
  29 import com.oracle.tools.packager.BundlerParamInfo;
  30 import com.oracle.tools.packager.JreUtils;
  31 import com.oracle.tools.packager.JreUtils.Rule;
  32 import com.oracle.tools.packager.StandardBundlerParam;
  33 import com.oracle.tools.packager.Log;
  34 import com.oracle.tools.packager.ConfigException;
  35 import com.oracle.tools.packager.IOUtils;
  36 import com.oracle.tools.packager.RelativeFileSet;
  37 import com.oracle.tools.packager.UnsupportedPlatformException;
  38 
  39 import java.io.File;
  40 import java.io.FileNotFoundException;
  41 import java.io.IOException;
  42 import java.io.PrintStream;
  43 import java.net.MalformedURLException;
  44 import java.net.URL;
  45 import java.text.MessageFormat;
  46 import java.util.*;
  47 
  48 import static com.oracle.tools.packager.StandardBundlerParam.*;
  49 
  50 public class LinuxAppBundler extends AbstractBundler {
  51 
  52     private static final ResourceBundle I18N =
  53             ResourceBundle.getBundle(LinuxAppBundler.class.getName());
  54     
  55     protected static final String LINUX_BUNDLER_PREFIX =
  56             BUNDLER_PREFIX + "linux" + File.separator;
  57     private static final String EXECUTABLE_NAME = "JavaAppLauncher";
  58 
  59     public static final BundlerParamInfo<File> ICON_PNG = new StandardBundlerParam<>(
  60             I18N.getString("param.icon-png.name"),
  61             I18N.getString("param.icon-png.description"),
  62             "icon.png",
  63             File.class,
  64             params -> {
  65                 File f = ICON.fetchFrom(params);
  66                 if (f != null && !f.getName().toLowerCase().endsWith(".png")) {
  67                     Log.info(MessageFormat.format(I18N.getString("message.icon-not-png"), f));
  68                     return null;
  69                 }
  70                 return f;
  71             },
  72             (s, p) -> new File(s));
  73