< prev index next >

modules/fxpackager/src/main/java/com/sun/javafx/tools/packager/bundlers/BundleParams.java

Print this page
rev 9619 : imported patch 9-jake-fxpackager.patch
   1 /*
   2  * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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.tools.packager.*;
  29 import com.oracle.tools.packager.linux.LinuxAppBundler;
  30 import com.oracle.tools.packager.mac.MacAppBundler;
  31 import com.oracle.tools.packager.windows.WindowsBundlerParam;
  32 import com.sun.javafx.tools.packager.bundlers.Bundler.BundleType;
  33 
  34 import java.io.File;
  35 import java.io.IOException;
  36 import java.util.*;
  37 import java.util.jar.Attributes;
  38 import java.util.jar.JarFile;
  39 import java.util.jar.Manifest;
  40 
  41 import static com.oracle.tools.packager.StandardBundlerParam.*;

  42 
  43 public class BundleParams {
  44 
  45     final protected Map<String, ? super Object> params;
  46 
  47     public static final String PARAM_RUNTIME                = "runtime"; // RelativeFileSet
  48     public static final String PARAM_APP_RESOURCES          = "appResources"; // RelativeFileSet
  49     public static final String PARAM_TYPE                   = "type"; // BundlerType
  50     public static final String PARAM_BUNDLE_FORMAT          = "bundleFormat"; // String
  51     public static final String PARAM_ICON                   = "icon"; // String
  52 
  53     /* Name of bundle file and native launcher */
  54     public static final String PARAM_NAME                   = "name"; // String
  55 
  56     /* application vendor, used by most of the bundlers */
  57     public static final String PARAM_VENDOR                 = "vendor"; // String
  58 
  59     /* email name and email, only used for debian */
  60     public static final String PARAM_EMAIL                  = "email"; // String
  61 


 153         return new HashMap<>(params);
 154     }
 155 
 156     public void setJvmargs(List<String> jvmargs) {
 157         putUnlessNullOrEmpty(JVM_OPTIONS.getID(), jvmargs);
 158     }
 159 
 160     public void setJvmUserArgs(Map<String, String> userArgs) {
 161 
 162         putUnlessNullOrEmpty(USER_JVM_OPTIONS.getID(), userArgs);
 163     }
 164 
 165     public void setJvmProperties(Map<String, String> jvmProperties) {
 166         putUnlessNullOrEmpty(JVM_PROPERTIES.getID(), jvmProperties);
 167     }
 168 
 169     public void setArguments(List<String> arguments) {
 170         putUnlessNullOrEmpty(ARGUMENTS.getID(), arguments);
 171     }
 172 

























 173     public String getApplicationID() {
 174         return fetchParam(IDENTIFIER);
 175     }
 176 
 177     public String getPreferencesID() {
 178         return fetchParam(PREFERENCES_ID);
 179     }
 180 
 181     public String getTitle() {
 182         return fetchParam(TITLE);
 183     }
 184 
 185     public void setTitle(String title) {
 186         putUnlessNull(PARAM_TITLE, title);
 187     }
 188 
 189     public String getApplicationClass() {
 190         return fetchParam(MAIN_CLASS);
 191     }
 192 


 232         licenseFiles.add(path);
 233     }
 234 
 235     public Boolean getSystemWide() {
 236         return fetchParam(SYSTEM_WIDE);
 237     }
 238 
 239     public void setSystemWide(Boolean b) {
 240         putUnlessNull(PARAM_SYSTEM_WIDE, b);
 241     }
 242 
 243     public void setServiceHint(Boolean b) {
 244         putUnlessNull(PARAM_SERVICE_HINT, b);
 245     }
 246 
 247     public void setInstalldirChooser(Boolean b) {
 248         putUnlessNull(PARAM_INSTALLDIR_CHOOSER, b);
 249     }
 250 
 251     public void setSignBundle(Boolean b) { putUnlessNull(SIGN_BUNDLE.getID(), b); }
 252 
 253     public com.oracle.tools.packager.RelativeFileSet getRuntime() {
 254         return getRuntime(params);
 255     }
 256 
 257     public static com.oracle.tools.packager.RelativeFileSet getRuntime(Map<String, ? super Object> params) {
 258         String os = System.getProperty("os.name").toLowerCase();
 259         if (os.startsWith("linux")) {
 260             return LinuxAppBundler.LINUX_RUNTIME.fetchFrom(params);
 261         } else if (os.contains("os x")) {
 262             return MacAppBundler.MAC_RUNTIME.fetchFrom(params);
 263         } else if (os.startsWith("win")) {
 264             return WindowsBundlerParam.WIN_RUNTIME.fetchFrom(params);
 265         } else {
 266             return null;
 267         }
 268     }
 269 
 270     public boolean isShortcutHint() {
 271         return fetchParam(SHORTCUT_HINT);
 272     }
 273 
 274     public void setShortcutHint(Boolean v) {
 275         putUnlessNull(PARAM_SHORTCUT, v);
 276     }
 277 
 278     public boolean isMenuHint() {
 279         return fetchParam(MENU_HINT);
 280     }
 281 
 282     public void setMenuHint(Boolean v) {
 283         putUnlessNull(PARAM_MENU, v);
 284     }
 285 
 286     public String getName() {
 287         return fetchParam(APP_NAME);
 288     }


   1 /*
   2  * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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.tools.packager.*;



  29 import com.sun.javafx.tools.packager.bundlers.Bundler.BundleType;
  30 
  31 import java.io.File;
  32 import java.io.IOException;
  33 import java.util.*;
  34 import java.util.jar.Attributes;
  35 import java.util.jar.JarFile;
  36 import java.util.jar.Manifest;
  37 
  38 import static com.oracle.tools.packager.StandardBundlerParam.*;
  39 import static com.oracle.tools.packager.JLinkBundlerHelper.*;
  40 
  41 public class BundleParams {
  42 
  43     final protected Map<String, ? super Object> params;
  44 
  45     public static final String PARAM_RUNTIME                = "runtime"; // RelativeFileSet
  46     public static final String PARAM_APP_RESOURCES          = "appResources"; // RelativeFileSet
  47     public static final String PARAM_TYPE                   = "type"; // BundlerType
  48     public static final String PARAM_BUNDLE_FORMAT          = "bundleFormat"; // String
  49     public static final String PARAM_ICON                   = "icon"; // String
  50 
  51     /* Name of bundle file and native launcher */
  52     public static final String PARAM_NAME                   = "name"; // String
  53 
  54     /* application vendor, used by most of the bundlers */
  55     public static final String PARAM_VENDOR                 = "vendor"; // String
  56 
  57     /* email name and email, only used for debian */
  58     public static final String PARAM_EMAIL                  = "email"; // String
  59 


 151         return new HashMap<>(params);
 152     }
 153 
 154     public void setJvmargs(List<String> jvmargs) {
 155         putUnlessNullOrEmpty(JVM_OPTIONS.getID(), jvmargs);
 156     }
 157 
 158     public void setJvmUserArgs(Map<String, String> userArgs) {
 159 
 160         putUnlessNullOrEmpty(USER_JVM_OPTIONS.getID(), userArgs);
 161     }
 162 
 163     public void setJvmProperties(Map<String, String> jvmProperties) {
 164         putUnlessNullOrEmpty(JVM_PROPERTIES.getID(), jvmProperties);
 165     }
 166 
 167     public void setArguments(List<String> arguments) {
 168         putUnlessNullOrEmpty(ARGUMENTS.getID(), arguments);
 169     }
 170 
 171     public void setAddModules(Set<String> addModules) {
 172         putUnlessNullOrEmpty(ADD_MODULES.getID(), addModules);
 173     }
 174 
 175     public void setLimitModules(Set<String> limitModules)  {
 176         putUnlessNullOrEmpty(LIMIT_MODULES.getID(), limitModules);
 177     }
 178 
 179     public void setDetectModules(Boolean detectModules) {
 180         putUnlessNull(DETECT_MODULES.getID(), detectModules);
 181     }
 182 
 183     public void setStripExecutables(Boolean value) {
 184         putUnlessNull(STRIP_NATIVE_COMMANDS.getID(), value);
 185     }
 186 
 187     public void setAppModulePath(String appModulePath) {
 188         putUnlessNull(JDK_MODULE_PATH.getID(), appModulePath);
 189     }
 190 
 191     public void setLinkModulePath(String linkModulePath) {
 192         putUnlessNull(MODULE_PATH.getID(), linkModulePath);
 193     }
 194 
 195 
 196     public String getApplicationID() {
 197         return fetchParam(IDENTIFIER);
 198     }
 199 
 200     public String getPreferencesID() {
 201         return fetchParam(PREFERENCES_ID);
 202     }
 203 
 204     public String getTitle() {
 205         return fetchParam(TITLE);
 206     }
 207 
 208     public void setTitle(String title) {
 209         putUnlessNull(PARAM_TITLE, title);
 210     }
 211 
 212     public String getApplicationClass() {
 213         return fetchParam(MAIN_CLASS);
 214     }
 215 


 255         licenseFiles.add(path);
 256     }
 257 
 258     public Boolean getSystemWide() {
 259         return fetchParam(SYSTEM_WIDE);
 260     }
 261 
 262     public void setSystemWide(Boolean b) {
 263         putUnlessNull(PARAM_SYSTEM_WIDE, b);
 264     }
 265 
 266     public void setServiceHint(Boolean b) {
 267         putUnlessNull(PARAM_SERVICE_HINT, b);
 268     }
 269 
 270     public void setInstalldirChooser(Boolean b) {
 271         putUnlessNull(PARAM_INSTALLDIR_CHOOSER, b);
 272     }
 273 
 274     public void setSignBundle(Boolean b) { putUnlessNull(SIGN_BUNDLE.getID(), b); }

















 275 
 276     public boolean isShortcutHint() {
 277         return fetchParam(SHORTCUT_HINT);
 278     }
 279 
 280     public void setShortcutHint(Boolean v) {
 281         putUnlessNull(PARAM_SHORTCUT, v);
 282     }
 283 
 284     public boolean isMenuHint() {
 285         return fetchParam(MENU_HINT);
 286     }
 287 
 288     public void setMenuHint(Boolean v) {
 289         putUnlessNull(PARAM_MENU, v);
 290     }
 291 
 292     public String getName() {
 293         return fetchParam(APP_NAME);
 294     }


< prev index next >