IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
Package.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2007-2014 Jeroen Frijters
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
24using System;
25using System.Collections.Generic;
26using System.IO;
27using System.Threading;
28
29using IKVM.Runtime;
31
33{
34
35 static class Package
36 {
37
38 static Dictionary<string, string> systemPackages;
39
43 static void LazyInitSystemPackages()
44 {
45#if FIRST_PASS
46 throw new NotImplementedException();
47#else
48 if (systemPackages == null)
49 {
50 var dict = new Dictionary<string, string>();
51 var path = Path.Combine(VfsTable.GetAssemblyResourcesPath(JVM.Vfs.Context, JVM.Context.Resolver.ResolveBaseAssembly().AsReflection(), JVM.Properties.HomePath), "resources.jar");
52 foreach (var pkgs in JVM.Context.ClassLoaderFactory.GetBootstrapClassLoader().GetPackageInfo())
53 foreach (var pkg in pkgs.Value)
54 dict[pkg.Replace('.', '/') + "/"] = path;
55
56 Interlocked.CompareExchange(ref systemPackages, dict, null);
57 }
58#endif
59 }
60
61 public static string getSystemPackage0(string name)
62 {
63 LazyInitSystemPackages();
64 systemPackages.TryGetValue(name, out string path);
65 return path;
66 }
67
68 public static string[] getSystemPackages0()
69 {
70 LazyInitSystemPackages();
71 var pkgs = new string[systemPackages.Count];
72 systemPackages.Keys.CopyTo(pkgs, 0);
73 return pkgs;
74 }
75
76 }
77
78}
System.Threading.Interlocked Interlocked
static string getSystemPackage0(string name)
Definition Package.cs:61
static string[] getSystemPackages0()
Definition Package.cs:68
Property values loaded into the JVM from various sources.
Main state of the running JVM.
ISymbolResolver Resolver
Gets the ISymbolResolver associated with this instance of the runtime.
RuntimeClassLoaderFactory ClassLoaderFactory
Gets the RuntimeClassLoaderFactory associated with this instance of the runtime.