author | herrick |
Tue, 08 Jan 2019 07:37:14 -0500 | |
branch | JDK-8200758-branch |
changeset 57099 | 9a85a7a076ad |
parent 57064 | a7fdadf67a92 |
child 57106 | ea870b9ce89a |
permissions | -rw-r--r-- |
57064
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
1 |
/* |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
4 |
* |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
10 |
* |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
15 |
* accompanied this code). |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
16 |
* |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
20 |
* |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
23 |
* questions. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
24 |
*/ |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
25 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
26 |
#include "Package.h" |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
27 |
#include "Lock.h" |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
28 |
#include "Helpers.h" |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
29 |
#include "Macros.h" |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
30 |
#include "IniFile.h" |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
31 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
32 |
#include <assert.h> |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
33 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
34 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
35 |
Package::Package(void) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
36 |
FInitialized = false; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
37 |
Initialize(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
38 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
39 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
40 |
TPlatformNumber StringToPercentageOfNumber(TString Value, |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
41 |
TPlatformNumber Number) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
42 |
TPlatformNumber result = 0; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
43 |
size_t percentage = atoi(PlatformString(Value.c_str())); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
44 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
45 |
if (percentage > 0 && Number > 0) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
46 |
result = Number * percentage / 100; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
47 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
48 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
49 |
return result; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
50 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
51 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
52 |
void Package::Initialize() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
53 |
if (FInitialized == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
54 |
return; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
55 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
56 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
57 |
Platform& platform = Platform::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
58 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
59 |
FBootFields = new PackageBootFields(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
60 |
FDebugging = dsNone; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
61 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
62 |
FBootFields->FPackageRootDirectory = platform.GetPackageRootDirectory(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
63 |
FBootFields->FPackageAppDirectory = platform.GetPackageAppDirectory(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
64 |
FBootFields->FPackageLauncherDirectory = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
65 |
platform.GetPackageLauncherDirectory(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
66 |
FBootFields->FAppDataDirectory = platform.GetAppDataDirectory(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
67 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
68 |
std::map<TString, TString> keys = platform.GetKeys(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
69 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
70 |
// Read from configure.cfg/Info.plist |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
71 |
AutoFreePtr<ISectionalPropertyContainer> config = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
72 |
platform.GetConfigFile(platform.GetConfigFileName()); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
73 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
74 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
75 |
keys[CONFIG_APP_ID_KEY], FBootFields->FAppID); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
76 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
77 |
keys[JPACKAGE_APP_DATA_DIR], FBootFields->FPackageAppDataDirectory); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
78 |
FBootFields->FPackageAppDataDirectory = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
79 |
FilePath::FixPathForPlatform(FBootFields->FPackageAppDataDirectory); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
80 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
81 |
// Main JAR. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
82 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
83 |
keys[CONFIG_MAINJAR_KEY], FBootFields->FMainJar); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
84 |
FBootFields->FMainJar = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
85 |
FilePath::IncludeTrailingSeparator(GetPackageAppDirectory()) |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
86 |
+ FilePath::FixPathForPlatform(FBootFields->FMainJar); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
87 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
88 |
// Main Module. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
89 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
90 |
keys[CONFIG_MAINMODULE_KEY], FBootFields->FMainModule); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
91 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
92 |
// Classpath. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
93 |
// 1. If the provided class path contains main jar then only use |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
94 |
// provided class path. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
95 |
// 2. If class path provided by config file is empty then add main jar. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
96 |
// 3. If main jar is not in provided class path then add it. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
97 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
98 |
keys[CONFIG_CLASSPATH_KEY], FBootFields->FClassPath); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
99 |
FBootFields->FClassPath = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
100 |
FilePath::FixPathSeparatorForPlatform(FBootFields->FClassPath); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
101 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
102 |
if (FBootFields->FClassPath.empty() == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
103 |
FBootFields->FClassPath = GetMainJar(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
104 |
} else if (FBootFields->FClassPath.find(GetMainJar()) == TString::npos) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
105 |
FBootFields->FClassPath = GetMainJar() |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
106 |
+ FilePath::PathSeparator() + FBootFields->FClassPath; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
107 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
108 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
109 |
// Modulepath. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
110 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
111 |
keys[CONFIG_MODULEPATH_KEY], FBootFields->FModulePath); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
112 |
FBootFields->FModulePath = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
113 |
FilePath::FixPathSeparatorForPlatform(FBootFields->FModulePath); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
114 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
115 |
// Main Class. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
116 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
117 |
keys[CONFIG_MAINCLASSNAME_KEY], FBootFields->FMainClassName); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
118 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
119 |
// Splash Screen. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
120 |
if (config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
121 |
keys[CONFIG_SPLASH_KEY], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
122 |
FBootFields->FSplashScreenFileName) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
123 |
FBootFields->FSplashScreenFileName = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
124 |
FilePath::IncludeTrailingSeparator(GetPackageAppDirectory()) |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
125 |
+ FilePath::FixPathForPlatform(FBootFields->FSplashScreenFileName); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
126 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
127 |
if (FilePath::FileExists(FBootFields->FSplashScreenFileName) == false) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
128 |
FBootFields->FSplashScreenFileName = _T(""); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
129 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
130 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
131 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
132 |
// Runtime. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
133 |
config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
134 |
keys[JVM_RUNTIME_KEY], FBootFields->FJVMRuntimeDirectory); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
135 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
136 |
// Read jvmargs. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
137 |
PromoteAppCDSState(config); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
138 |
ReadJVMArgs(config); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
139 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
140 |
// Read args if none were passed in. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
141 |
if (FBootFields->FArgs.size() == 0) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
142 |
OrderedMap<TString, TString> args; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
143 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
144 |
if (config->GetSection(keys[CONFIG_SECTION_ARGOPTIONS], args) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
145 |
FBootFields->FArgs = Helpers::MapToNameValueList(args); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
146 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
147 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
148 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
149 |
// Auto Memory. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
150 |
TString autoMemory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
151 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
152 |
if (config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
153 |
keys[CONFIG_APP_MEMORY], autoMemory) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
154 |
if (autoMemory == _T("auto") || autoMemory == _T("100%")) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
155 |
FBootFields->FMemoryState = PackageBootFields::msAuto; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
156 |
FBootFields->FMemorySize = platform.GetMemorySize(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
157 |
} else if (autoMemory.length() == 2 && isdigit(autoMemory[0]) && |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
158 |
autoMemory[1] == '%') { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
159 |
FBootFields->FMemoryState = PackageBootFields::msAuto; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
160 |
FBootFields->FMemorySize = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
161 |
StringToPercentageOfNumber(autoMemory.substr(0, 1), |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
162 |
platform.GetMemorySize()); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
163 |
} else if (autoMemory.length() == 3 && isdigit(autoMemory[0]) && |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
164 |
isdigit(autoMemory[1]) && autoMemory[2] == '%') { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
165 |
FBootFields->FMemoryState = PackageBootFields::msAuto; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
166 |
FBootFields->FMemorySize = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
167 |
StringToPercentageOfNumber(autoMemory.substr(0, 2), |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
168 |
platform.GetMemorySize()); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
169 |
} else { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
170 |
FBootFields->FMemoryState = PackageBootFields::msManual; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
171 |
FBootFields->FMemorySize = 0; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
172 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
173 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
174 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
175 |
// Debug |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
176 |
TString debug; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
177 |
if (config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
178 |
keys[CONFIG_APP_DEBUG], debug) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
179 |
FBootFields->FArgs.push_back(debug); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
180 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
181 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
182 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
183 |
void Package::Clear() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
184 |
FreeBootFields(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
185 |
FInitialized = false; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
186 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
187 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
188 |
// This is the only location that the AppCDS state should be modified except |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
189 |
// by command line arguments provided by the user. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
190 |
// |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
191 |
// The state of AppCDS is as follows: |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
192 |
// |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
193 |
// -> cdsUninitialized |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
194 |
// -> cdsGenCache If -Xappcds:generatecache |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
195 |
// -> cdsDisabled If -Xappcds:off |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
196 |
// -> cdsEnabled If "AppCDSJVMOptions" section is present |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
197 |
// -> cdsAuto If "AppCDSJVMOptions" section is present and |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
198 |
// app.appcds.cache=auto |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
199 |
// -> cdsDisabled Default |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
200 |
// |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
201 |
void Package::PromoteAppCDSState(ISectionalPropertyContainer* Config) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
202 |
Platform& platform = Platform::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
203 |
std::map<TString, TString> keys = platform.GetKeys(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
204 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
205 |
// The AppCDS state can change at this point. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
206 |
switch (platform.GetAppCDSState()) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
207 |
case cdsEnabled: |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
208 |
case cdsAuto: |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
209 |
case cdsDisabled: |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
210 |
case cdsGenCache: { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
211 |
// Do nothing. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
212 |
break; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
213 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
214 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
215 |
case cdsUninitialized: { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
216 |
if (Config->ContainsSection( |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
217 |
keys[CONFIG_SECTION_APPCDSJVMOPTIONS]) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
218 |
// If the AppCDS section is present then enable AppCDS. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
219 |
TString appCDSCacheValue; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
220 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
221 |
// If running with AppCDS enabled, and the configuration has |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
222 |
// been setup so "auto" is enabled, then |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
223 |
// the launcher will attempt to generate the cache file |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
224 |
// automatically and run the application. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
225 |
if (Config->GetValue(keys[CONFIG_SECTION_APPLICATION], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
226 |
_T("app.appcds.cache"), appCDSCacheValue) == true && |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
227 |
appCDSCacheValue == _T("auto")) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
228 |
platform.SetAppCDSState(cdsAuto); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
229 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
230 |
else { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
231 |
platform.SetAppCDSState(cdsEnabled); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
232 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
233 |
} else { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
234 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
235 |
platform.SetAppCDSState(cdsDisabled); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
236 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
237 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
238 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
239 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
240 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
241 |
void Package::ReadJVMArgs(ISectionalPropertyContainer* Config) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
242 |
Platform& platform = Platform::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
243 |
std::map<TString, TString> keys = platform.GetKeys(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
244 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
245 |
// Evaluate based on the current AppCDS state. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
246 |
switch (platform.GetAppCDSState()) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
247 |
case cdsUninitialized: { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
248 |
throw Exception(_T("Internal Error")); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
249 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
250 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
251 |
case cdsDisabled: { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
252 |
Config->GetSection(keys[CONFIG_SECTION_JVMOPTIONS], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
253 |
FBootFields->FJVMArgs); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
254 |
break; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
255 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
256 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
257 |
case cdsGenCache: { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
258 |
Config->GetSection(keys[ |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
259 |
CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
260 |
FBootFields->FJVMArgs); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
261 |
break; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
262 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
263 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
264 |
case cdsAuto: |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
265 |
case cdsEnabled: { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
266 |
if (Config->GetValue(keys[CONFIG_SECTION_APPCDSJVMOPTIONS], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
267 |
_T( "-XX:SharedArchiveFile"), |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
268 |
FBootFields->FAppCDSCacheFileName) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
269 |
// File names may contain the incorrect path separators. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
270 |
// The cache file name must be corrected at this point. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
271 |
if (FBootFields->FAppCDSCacheFileName.empty() == false) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
272 |
IniFile* iniConfig = dynamic_cast<IniFile*>(Config); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
273 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
274 |
if (iniConfig != NULL) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
275 |
FBootFields->FAppCDSCacheFileName = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
276 |
FilePath::FixPathForPlatform( |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
277 |
FBootFields->FAppCDSCacheFileName); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
278 |
iniConfig->SetValue(keys[ |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
279 |
CONFIG_SECTION_APPCDSJVMOPTIONS], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
280 |
_T( "-XX:SharedArchiveFile"), |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
281 |
FBootFields->FAppCDSCacheFileName); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
282 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
283 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
284 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
285 |
Config->GetSection(keys[CONFIG_SECTION_APPCDSJVMOPTIONS], |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
286 |
FBootFields->FJVMArgs); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
287 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
288 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
289 |
break; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
290 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
291 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
292 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
293 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
294 |
void Package::SetCommandLineArguments(int argc, TCHAR* argv[]) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
295 |
if (argc > 0) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
296 |
std::list<TString> args; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
297 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
298 |
// Prepare app arguments. Skip value at index 0 - |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
299 |
// this is path to executable. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
300 |
FBootFields->FCommandName = argv[0]; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
301 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
302 |
// Path to executable is at 0 index so start at index 1. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
303 |
for (int index = 1; index < argc; index++) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
304 |
TString arg = argv[index]; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
305 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
306 |
#ifdef DEBUG |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
307 |
if (arg == _T("-debug")) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
308 |
FDebugging = dsNative; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
309 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
310 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
311 |
if (arg == _T("-javadebug")) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
312 |
FDebugging = dsJava; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
313 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
314 |
#endif //DEBUG |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
315 |
#ifdef MAC |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
316 |
if (arg.find(_T("-psn_"), 0) != TString::npos) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
317 |
Platform& platform = Platform::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
318 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
319 |
if (platform.IsMainThread() == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
320 |
#ifdef DEBUG |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
321 |
printf("%s\n", arg.c_str()); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
322 |
#endif //DEBUG |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
323 |
continue; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
324 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
325 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
326 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
327 |
if (arg == _T("-NSDocumentRevisionsDebugMode")) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
328 |
// Ignore -NSDocumentRevisionsDebugMode and |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
329 |
// the following YES/NO |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
330 |
index++; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
331 |
continue; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
332 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
333 |
#endif //MAC |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
334 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
335 |
args.push_back(arg); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
336 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
337 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
338 |
if (args.size() > 0) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
339 |
FBootFields->FArgs = args; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
340 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
341 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
342 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
343 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
344 |
Package& Package::GetInstance() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
345 |
static Package instance; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
346 |
// Guaranteed to be destroyed. Instantiated on first use. |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
347 |
return instance; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
348 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
349 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
350 |
Package::~Package(void) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
351 |
FreeBootFields(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
352 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
353 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
354 |
void Package::FreeBootFields() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
355 |
if (FBootFields != NULL) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
356 |
delete FBootFields; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
357 |
FBootFields = NULL; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
358 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
359 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
360 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
361 |
OrderedMap<TString, TString> Package::GetJVMArgs() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
362 |
return FBootFields->FJVMArgs; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
363 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
364 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
365 |
std::vector<TString> GetKeysThatAreNotDuplicates(OrderedMap<TString, |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
366 |
TString> &Defaults, OrderedMap<TString, TString> &Overrides) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
367 |
std::vector<TString> result; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
368 |
std::vector<TString> overrideKeys = Overrides.GetKeys(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
369 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
370 |
for (size_t index = 0; index < overrideKeys.size(); index++) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
371 |
TString overridesKey = overrideKeys[index]; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
372 |
TString overridesValue; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
373 |
TString defaultValue; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
374 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
375 |
if ((Defaults.ContainsKey(overridesKey) == false) || |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
376 |
(Defaults.GetValue(overridesKey, defaultValue) == true && |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
377 |
Overrides.GetValue(overridesKey, overridesValue) == true && |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
378 |
defaultValue != overridesValue)) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
379 |
result.push_back(overridesKey); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
380 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
381 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
382 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
383 |
return result; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
384 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
385 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
386 |
OrderedMap<TString, TString> CreateOrderedMapFromKeyList(OrderedMap<TString, |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
387 |
TString> &Map, std::vector<TString> &Keys) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
388 |
OrderedMap<TString, TString> result; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
389 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
390 |
for (size_t index = 0; index < Keys.size(); index++) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
391 |
TString key = Keys[index]; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
392 |
TString value; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
393 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
394 |
if (Map.GetValue(key, value) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
395 |
result.Append(key, value); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
396 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
397 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
398 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
399 |
return result; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
400 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
401 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
402 |
std::vector<TString> GetKeysThatAreNotOverridesOfDefaultValues( |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
403 |
OrderedMap<TString, TString> &Defaults, OrderedMap<TString, |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
404 |
TString> &Overrides) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
405 |
std::vector<TString> result; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
406 |
std::vector<TString> keys = Overrides.GetKeys(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
407 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
408 |
for (unsigned int index = 0; index< keys.size(); index++) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
409 |
TString key = keys[index]; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
410 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
411 |
if (Defaults.ContainsKey(key) == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
412 |
try { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
413 |
TString value = Overrides[key]; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
414 |
Defaults[key] = value; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
415 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
416 |
catch (std::out_of_range) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
417 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
418 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
419 |
else { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
420 |
result.push_back(key); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
421 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
422 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
423 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
424 |
return result; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
425 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
426 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
427 |
std::list<TString> Package::GetArgs() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
428 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
429 |
return FBootFields->FArgs; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
430 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
431 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
432 |
TString Package::GetPackageRootDirectory() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
433 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
434 |
return FBootFields->FPackageRootDirectory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
435 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
436 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
437 |
TString Package::GetPackageAppDirectory() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
438 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
439 |
return FBootFields->FPackageAppDirectory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
440 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
441 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
442 |
TString Package::GetPackageLauncherDirectory() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
443 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
444 |
return FBootFields->FPackageLauncherDirectory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
445 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
446 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
447 |
TString Package::GetAppDataDirectory() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
448 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
449 |
return FBootFields->FAppDataDirectory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
450 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
451 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
452 |
TString Package::GetAppCDSCacheDirectory() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
453 |
if (FAppCDSCacheDirectory.empty()) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
454 |
Platform& platform = Platform::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
455 |
FAppCDSCacheDirectory = FilePath::IncludeTrailingSeparator( |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
456 |
platform.GetAppDataDirectory()) |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
457 |
+ FilePath::IncludeTrailingSeparator( |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
458 |
GetPackageAppDataDirectory()) + _T("cache"); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
459 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
460 |
Macros& macros = Macros::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
461 |
FAppCDSCacheDirectory = macros.ExpandMacros(FAppCDSCacheDirectory); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
462 |
FAppCDSCacheDirectory = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
463 |
FilePath::FixPathForPlatform(FAppCDSCacheDirectory); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
464 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
465 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
466 |
return FAppCDSCacheDirectory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
467 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
468 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
469 |
TString Package::GetAppCDSCacheFileName() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
470 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
471 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
472 |
if (FBootFields->FAppCDSCacheFileName.empty() == false) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
473 |
Macros& macros = Macros::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
474 |
FBootFields->FAppCDSCacheFileName = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
475 |
macros.ExpandMacros(FBootFields->FAppCDSCacheFileName); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
476 |
FBootFields->FAppCDSCacheFileName = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
477 |
FilePath::FixPathForPlatform(FBootFields->FAppCDSCacheFileName); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
478 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
479 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
480 |
return FBootFields->FAppCDSCacheFileName; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
481 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
482 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
483 |
TString Package::GetAppID() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
484 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
485 |
return FBootFields->FAppID; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
486 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
487 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
488 |
TString Package::GetPackageAppDataDirectory() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
489 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
490 |
return FBootFields->FPackageAppDataDirectory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
491 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
492 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
493 |
TString Package::GetClassPath() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
494 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
495 |
return FBootFields->FClassPath; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
496 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
497 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
498 |
TString Package::GetModulePath() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
499 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
500 |
return FBootFields->FModulePath; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
501 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
502 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
503 |
TString Package::GetMainJar() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
504 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
505 |
return FBootFields->FMainJar; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
506 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
507 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
508 |
TString Package::GetMainModule() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
509 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
510 |
return FBootFields->FMainModule; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
511 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
512 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
513 |
TString Package::GetMainClassName() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
514 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
515 |
return FBootFields->FMainClassName; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
516 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
517 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
518 |
TString Package::GetJVMLibraryFileName() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
519 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
520 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
521 |
if (FBootFields->FJVMLibraryFileName.empty() == true) { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
522 |
Platform& platform = Platform::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
523 |
Macros& macros = Macros::GetInstance(); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
524 |
TString jvmRuntimePath = macros.ExpandMacros(GetJVMRuntimeDirectory()); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
525 |
FBootFields->FJVMLibraryFileName = |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
526 |
platform.GetBundledJVMLibraryFileName(jvmRuntimePath); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
527 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
528 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
529 |
return FBootFields->FJVMLibraryFileName; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
530 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
531 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
532 |
TString Package::GetJVMRuntimeDirectory() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
533 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
534 |
return FBootFields->FJVMRuntimeDirectory; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
535 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
536 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
537 |
TString Package::GetSplashScreenFileName() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
538 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
539 |
return FBootFields->FSplashScreenFileName; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
540 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
541 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
542 |
bool Package::HasSplashScreen() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
543 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
544 |
return FilePath::FileExists(FBootFields->FSplashScreenFileName); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
545 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
546 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
547 |
TString Package::GetCommandName() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
548 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
549 |
return FBootFields->FCommandName; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
550 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
551 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
552 |
TPlatformNumber Package::GetMemorySize() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
553 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
554 |
return FBootFields->FMemorySize; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
555 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
556 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
557 |
PackageBootFields::MemoryState Package::GetMemoryState() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
558 |
assert(FBootFields != NULL); |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
559 |
return FBootFields->FMemoryState; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
560 |
} |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
561 |
|
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
562 |
DebugState Package::Debugging() { |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
563 |
return FDebugging; |
a7fdadf67a92
8214899: rename papplauncher and it's library and move src to appropriate places
herrick
parents:
diff
changeset
|
564 |
} |