1 /*
   2  * Copyright (c) 2011, 2013, 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.resource;
  27 
  28 import java.io.File;
  29 
  30 /**
  31  * @deprecated use {@link ToolProvider} to locate the {@code "javapackager"} tool instead.
  32  */
  33 @Deprecated(since="10", forRemoval=true)
  34 public class DeployResource extends PackagerResource {
  35     private final Type type;
  36     private final String mode;
  37     private final String os;
  38     private final String arch;
  39 
  40     public static enum Type {
  41         UNKNOWN, jnlp, jar, nativelib, icon, license, data
  42     };
  43 
  44     public static final String TYPE_LICENSE = "license";
  45     public static final String TYPE_DATA    = "data";
  46 
  47     public DeployResource(final File baseDir, final String path) {
  48         this(baseDir, path, "eager");
  49     }
  50 
  51     public DeployResource(final File baseDir, final File file) {
  52         this(baseDir, file, "eager");
  53     }
  54 
  55     public DeployResource(final File baseDir, final String path,
  56                           final String mode) {
  57         super(baseDir, path);
  58         this.mode = mode;
  59         this.type = null;
  60         this.os = null;
  61         this.arch = null;
  62     }
  63 
  64     public DeployResource(final File baseDir, final File file,
  65                           final String mode) {
  66         this(baseDir, file, mode, null, null, null);
  67     }
  68 
  69     public DeployResource(final File baseDir, final File file,
  70                           final String mode, final String type,
  71                           final String os, final String arch) {
  72         super(baseDir, file);
  73         if (type == null) {
  74            if (file.getName().endsWith(".jar")) {
  75                this.type = Type.jar;
  76            } else if (file.getName().endsWith(".jnlp")) {
  77                this.type = Type.jnlp;
  78            } else {
  79             this.type = Type.UNKNOWN;
  80            }
  81         } else {
  82               this.type = Type.valueOf(type);
  83         }
  84         this.os = os;
  85         this.arch = arch;
  86         this.mode = mode;
  87     }
  88 
  89     public String getMode() {
  90         return mode;
  91     }
  92 
  93     public Type getType() {
  94         return type;
  95     }
  96 
  97     public String getOs() {
  98         return os;
  99     }
 100 
 101     public String getArch() {
 102         return arch;
 103     }
 104 }