src/jdk.jpackage/share/native/library/common/Package.h
branchJDK-8200758-branch
changeset 57054 32d2b2d2d353
parent 57053 700a46deb15d
child 57055 cac1ec6a34ee
equal deleted inserted replaced
57053:700a46deb15d 57054:32d2b2d2d353
     1 /*
       
     2  * Copyright (c) 2014, 2018, 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 #ifndef PACKAGE_H
       
    27 #define PACKAGE_H
       
    28 
       
    29 
       
    30 #include "Platform.h"
       
    31 #include "PlatformString.h"
       
    32 #include "FilePath.h"
       
    33 #include "PropertyFile.h"
       
    34 
       
    35 #include <map>
       
    36 #include <list>
       
    37 
       
    38 class PackageBootFields {
       
    39 public:
       
    40     enum MemoryState {msManual, msAuto};
       
    41 
       
    42 public:
       
    43     OrderedMap<TString, TString> FJVMArgs;
       
    44     std::list<TString> FArgs;
       
    45 
       
    46     TString FPackageRootDirectory;
       
    47     TString FPackageAppDirectory;
       
    48     TString FPackageLauncherDirectory;
       
    49     TString FAppDataDirectory;
       
    50     TString FAppID;
       
    51     TString FPackageAppDataDirectory;
       
    52     TString FClassPath;
       
    53     TString FModulePath;
       
    54     TString FMainJar;
       
    55     TString FMainModule;
       
    56     TString FMainClassName;
       
    57     TString FJVMRuntimeDirectory;
       
    58     TString FJVMLibraryFileName;
       
    59     TString FSplashScreenFileName;
       
    60     bool FUseJavaPreferences;
       
    61     TString FCommandName;
       
    62 
       
    63     TString FAppCDSCacheFileName;
       
    64 
       
    65     TPlatformNumber FMemorySize;
       
    66     MemoryState FMemoryState;
       
    67 };
       
    68 
       
    69 
       
    70 class Package {
       
    71 private:
       
    72     Package(Package const&); // Don't Implement.
       
    73     void operator=(Package const&); // Don't implement
       
    74 
       
    75 private:
       
    76     bool FInitialized;
       
    77     PackageBootFields* FBootFields;
       
    78     TString FAppCDSCacheDirectory;
       
    79 
       
    80     DebugState FDebugging;
       
    81 
       
    82     Package(void);
       
    83 
       
    84     TString GetMainJar();
       
    85     void ReadJVMArgs(ISectionalPropertyContainer* Config);
       
    86     void PromoteAppCDSState(ISectionalPropertyContainer* Config);
       
    87 
       
    88 public:
       
    89     static Package& GetInstance();
       
    90     ~Package(void);
       
    91 
       
    92     void Initialize();
       
    93     void Clear();
       
    94     void FreeBootFields();
       
    95     bool CheckForSingleInstance();
       
    96 
       
    97     void SetCommandLineArguments(int argc, TCHAR* argv[]);
       
    98 
       
    99     OrderedMap<TString, TString> GetJVMArgs();
       
   100     TString GetMainModule();
       
   101 
       
   102     std::list<TString> GetArgs();
       
   103 
       
   104     TString GetPackageRootDirectory();
       
   105     TString GetPackageAppDirectory();
       
   106     TString GetPackageLauncherDirectory();
       
   107     TString GetAppDataDirectory();
       
   108 
       
   109     TString GetAppCDSCacheDirectory();
       
   110     TString GetAppCDSCacheFileName();
       
   111 
       
   112     TString GetAppID();
       
   113     TString GetPackageAppDataDirectory();
       
   114     TString GetClassPath();
       
   115     TString GetModulePath();
       
   116     TString GetMainClassName();
       
   117     TString GetJVMLibraryFileName();
       
   118     TString GetJVMRuntimeDirectory();
       
   119     TString GetSplashScreenFileName();
       
   120     bool HasSplashScreen();
       
   121     TString GetCommandName();
       
   122 
       
   123     TPlatformNumber GetMemorySize();
       
   124     PackageBootFields::MemoryState GetMemoryState();
       
   125 
       
   126     DebugState Debugging();
       
   127 };
       
   128 
       
   129 #endif // PACKAGE_H