Gets the ResourceManager with the given name.

@param bundleName
@return the ResourceManager with the given name.
778693
public static ResourceManager get(String bundleName) {
        ResourceManager rm = (ResourceManager) nameToRM.get(bundleName);
        if (rm == null) {
            ResourceBundle rb = ResourceBundle.getBundle(bundleName);
            rm = new ResourceManager(rb);
            nameToRM.put(bundleName, rm);
        }
        return rm;
    }
273096
private URL getResourceFromBundle(Object resource, String resourcePath, String versionRange)
    {
        URL url = null;
        if (resource == null)
        {
            Object classAccess = this.getClassBundleService(null, ClassFinderActivator.getPackageName(resourcePath, true) + FAKE_CLASSNAME, versionRange, null, 0);
            if (classAccess != null)
                url = classAccess.getClass().getClassLoader().getResource(resourcePath);
        }
        else
        {
        	Bundle bundle = this.findBundle(resource, bundleContext, ClassFinderActivator.getPackageName(resourcePath, true), versionRange);
            url = bundle.getEntry(resourcePath);
        }
        return url;
    }
475598
private static String getResource(Bundle myBundle, String resourcePath) {
        if (myBundle == null)
            return null;
        String bundleShortDescription = getBundleDescription(myBundle);
        StringBuilder responseString = new StringBuilder();
        URL bundleResource = myBundle.getResource(resourcePath);
        if (bundleResource != null) {
            BufferedReader br = null;
            try { // read the requested resource from the bundle
                br = new BufferedReader(new InputStreamReader(bundleResource.openConnection().getInputStream(), "UTF-8"));
                while (br.ready()) {
                    responseString.append(br.readLine());
                }
                br.close();
            } catch (Exception e) { // shouldn't happen
                if (OpenAPIUtils.isEventEnabled(tc)) {
                    Tr.event(tc, "Exception trying to read resource at " + resourcePath + " from bundle " + bundleShortDescription);
                }
            }

        } else {
            if (OpenAPIUtils.isEventEnabled(tc)) {
                Tr.event(tc, "Unexpected error getting resource from WAB bundle.");
            }
        }
        return responseString.toString();
    }
505735
public Observable<ClusterInner> getByResourceGroupAsync(String resourceGroupName, String clusterName) {
        return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() {
            @Override
            public ClusterInner call(ServiceResponse<ClusterInner> response) {
                return response.body();
            }
        });
    }
1231314
@Override
	public Bundle getBundle(String bundleName) {
		final String sourceMethod = "getBundle"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(FallbackBundleResolver.class.getName(), sourceMethod, new Object[]{bundleName});
		}
		Bundle result = Platform.getBundle(bundleName);
		if (isTraceLogging) {
			log.exiting(FallbackBundleResolver.class.getName(), sourceMethod, result);
		}
		return result;
	}
152662
private static I_CmsResourceBundle tryBundle(String localizedName) {

        I_CmsResourceBundle result = null;

        try {

            String resourceName = localizedName.replace('.', '/') + ".properties";
            URL url = CmsResourceBundleLoader.class.getClassLoader().getResource(resourceName);

            I_CmsResourceBundle additionalBundle = m_permanentCache.get(localizedName);
            if (additionalBundle != null) {
                result = additionalBundle.getClone();
            } else if (url != null) {
                // the resource was found on the file system
                InputStream is = null;
                String path = CmsFileUtil.normalizePath(url);
                File file = new File(path);
                try {
                    // try to load the resource bundle from a file, NOT with the resource loader first
                    // this is important since using #getResourceAsStream() may return cached results,
                    // for example Tomcat by default does cache all resources loaded by the class loader
                    // this means a changed resource bundle file is not loaded
                    is = new FileInputStream(file);
                } catch (IOException ex) {
                    // this will happen if the resource is contained for example in a .jar file
                    is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);
                } catch (AccessControlException acex) {
                    // fixed bug #1550
                    // this will happen if the resource is contained for example in a .jar file
                    // and security manager is turned on.
                    is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);
                }
                if (is != null) {
                    result = new CmsPropertyResourceBundle(is);
                }
            }
        } catch (IOException ex) {
            // can't localized these message since this may lead to a chicken-egg problem
            MissingResourceException mre = new MissingResourceException(
                "Failed to load bundle '" + localizedName + "'",
                localizedName,
                "");
            mre.initCause(ex);
            throw mre;
        }

        return result;
    }
128452
public static String getProperty(final ResourceBundle bundle, final String key) {
		if (bundle == null) {
			return key;
		}
		try {
			return bundle.getString(key);
		} catch (MissingResourceException e) {
			LOG.warn("找不到名为 " + key + " 的资源项", e);
			return key;
		}
	}
1045789
public static function getNamespace($bundleName)
    {
        if (isset(self::$bundlesLoaded[$bundleName])) {
            return self::$bundlesLoaded[$bundleName]['namespace'];
        }

        throw new MissingBundleException(sprintf('Bundle "%s" could not be found.', $bundleName));
    }
24251
public function getDescriptorByName(string $bundleName): ?Descriptor
    {
        if (!$this->isEmpty()) {
            /** @var Descriptor $descriptor */
            foreach ($this as $rootNamespace => $descriptor) {
                $name = $descriptor->getName();

                if ($bundleName === $name) {
                    return $descriptor;
                }
            }
        }

        return null;
    }
426228
public static @Nonnull JSONObject getBundle(@Nonnull String baseName, @Nonnull Locale locale) throws MissingResourceException {
        String bundleKey = baseName + ":" + locale.toString();
        JSONObject bundleJSON = bundles.get(bundleKey);

        if (bundleJSON != null) {
            return bundleJSON;
        }

        ResourceBundle bundle = getBundle(baseName, locale, Jenkins.class.getClassLoader());
        if (bundle == null) {
            // Not in Jenkins core. Check the plugins.
            Jenkins jenkins = Jenkins.getInstance(); // will never return null
            if (jenkins != null) {
                for (PluginWrapper plugin : jenkins.getPluginManager().getPlugins()) {
                    bundle = getBundle(baseName, locale, plugin.classLoader);
                    if (bundle != null) {
                        break;
                    }
                }
            }
        }
        if (bundle == null) {
            throw new MissingResourceException("Can't find bundle for base name "
                    + baseName + ", locale " + locale, baseName + "_" + locale, "");
        }

        bundleJSON = toJSONObject(bundle);
        bundles.put(bundleKey, bundleJSON);

        return bundleJSON;
    }
855599
public URL getResource(final String name) {
		final String normalizedName = Path.normalizeResourcePath(rootPath
				+ (name.startsWith("/") ? "" : "/") + name).trim();

		log.debug("Searching bundle " + bundle
						+ " for resource [{}], normalized to [{}]", name,
				normalizedName);

		URL url = resourceCache.get(normalizedName);

		if (url == null && !normalizedName.isEmpty()) {
			url = bundle.getEntry(normalizedName);
			if (url == null) {
				log.debug("getEntry failed, trying with /META-INF/resources/ in bundle class space");
				// Search attached bundles for web-fragments
				Set<Bundle> bundlesInClassSpace = ClassPathUtil.getBundlesInClassSpace(bundle, new HashSet<>());
				for (Bundle bundleInClassSpace : bundlesInClassSpace) {
					url = bundleInClassSpace.getEntry("/META-INF/resources/" + normalizedName);
					if (url != null) {
						break;
					}
				}
			}
			// obviously still not found might be available from a attached bundle resource
			if (url == null) {
				log.debug("getEntry failed, fallback to getResource");
				url = bundle.getResource(normalizedName);
			}
			if (url == null) {
				url = NO_URL;
			}
			resourceCache.putIfAbsent(normalizedName, url);
		}

		if (url != null && url != NO_URL) {
			log.debug("Resource found as url [{}]", url);
		} else {
			log.debug("Resource not found");
			url = null;
		}
		return url;
	}
539153
public Bundle getBundle(String symbolicName) {
		final String sourceMethod = "getBundle"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(FrameworkWiringBundleResolver.class.getName(), sourceMethod, new Object[]{symbolicName});
		}
		Bundle[] candidates = Platform.getBundles(symbolicName, null);
		if (isTraceLogging) {
			log.finer("candidate bundles = " + Arrays.toString(candidates)); //$NON-NLS-1$
		}
		if (candidates == null || candidates.length == 0) {
			if (isTraceLogging) {
				log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, null);
			}
			return null;
		}
		if (candidates.length == 1) {
			// Only one choice, so return it
			if (isTraceLogging) {
				log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, candidates[0]);
			}
			return candidates[0];
		}
		if (fw == null) {
			if (isTraceLogging) {
				log.finer("Framework wiring not available.  Returning bundle with latest version"); //$NON-NLS-1$
				log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, candidates[0]);
			}
			return candidates[0];
		}
		Bundle result = null;
		// For each candidate bundle, check to see if it's wired, directly or indirectly, to the contributing bundle
		for (Bundle candidate : candidates) {
			Collection<Bundle> bundles = fw.getDependencyClosure(Arrays.asList(new Bundle[]{candidate}));
			for (Bundle bundle : bundles) {
				if (bundle.equals(contributingBundle)) {
					// found wired bundle.  Return the candidate.
					result = candidate;
					break;
				}
			}
			if (result != null) {
				break;
			}
		}
		if (result == null) {
			if (isTraceLogging) {
				log.finer("No wired bundle found amoung candidates.  Returning bundle with most recent version."); //$NON-NLS-1$
			}
			result =  candidates[0];
		}
		if (isTraceLogging) {
			log.exiting(FrameworkWiringBundleResolver.class.getName(), sourceMethod, result);
		}
		return result;
	}
1250784
private JoinableResourceBundle getBundleFromName(String name, List<JoinableResourceBundle> bundles) {

		JoinableResourceBundle bundle = null;
		for (JoinableResourceBundle aBundle : bundles) {
			if (aBundle.getName().equals(name)) {
				bundle = aBundle;
				break;
			}
		}

		return bundle;
	}
647075
public static Logger getLogger(final String name, final String resourceBundleName){
		WebContainerLogger tempLogger = map.get(name);
		if (tempLogger==null){
			tempLogger = (WebContainerLogger) AccessController.doPrivileged(
			    new PrivilegedAction<WebContainerLogger>() {
    				public WebContainerLogger run() {
    					return new WebContainerLogger(
    					    Logger.getLogger(name,resourceBundleName),
    					    name, resourceBundleName);
				}
			});
			map.put(name, tempLogger);
		}
			return tempLogger;
	}
609581
@Override
	public Enumeration<URL> getResources(String name) throws IOException {
		return bundleClassLoader.getResources(name);
	}
370262
protected Dictionary<?, ?> getBundleHeaders(String bundleName) throws NotFoundException {
		final String sourceMethod = "getBundleHeaders"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(BundleVersionsHashBase.class.getName(), sourceMethod, new Object[]{bundleName});
		}

		Bundle result = ".".equals(bundleName) ? contributingBundle : bundleResolver.getBundle(bundleName); //$NON-NLS-1$

		if (result == null) {
			throw new NotFoundException("Bundle " + bundleName + " not found."); //$NON-NLS-1$ //$NON-NLS-2$
		}
		if (isTraceLogging) {
			log.exiting(BundleVersionsHashBase.class.getName(), sourceMethod, result.getHeaders());
		}
		return result.getHeaders();
	}
1142247
@Override
    protected URL findResource(String name) {
        URL result = null;
        // Only check the parent bundle loader if the request is outside of "" or "/"
        if (!!!"".equals(name) && !!!"/".equals(name)) {
            // First try the bundleLoader
            result = bundleLoader.getResource(name);
        }
        // This doesn't have access to ALL split packages (it just gets one) so it's augmented with a resource provider  
        return result == null ? resourceProviders.findResource(name) : result;
    }