Locates the {@link ResourceBundleHolder} for this CLI method.
501210
private ResourceBundleHolder loadMessageBundle(Method m) throws ClassNotFoundException {
        Class c = m.getDeclaringClass();
        Class<?> msg = c.getClassLoader().loadClass(c.getName().substring(0, c.getName().lastIndexOf(".")) + ".Messages");
        return ResourceBundleHolder.get(msg);
    }
1276321
private Optional<ResourceBundle> getResourceBundle(final String name) {
		try {
			LOGGER.debug("Resource bundle: " + name);
			return Optional.of(getBundle(name,
				new ResourceBundleControl(getResourceBundleCharset())));
		} catch (final MissingResourceException ex) {
			LOGGER.debug("No resource bundle could be determined: " + ex.getMessage());
			return Optional.empty();
		}
	}
77643
@Override
    Resource getResource(final String relativePath) {
        return allResourcePaths.contains(relativePath) ? newResource(relativePath) : null;
    }
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();
    }
974746
private ResourceGenerator loadCommonGenerator(String resourcePath) {

		ResourceGenerator generator = null;

		for (Entry<ResourceGeneratorResolver, Class<?>> entry : commonGenerators.entrySet()) {
			ResourceGeneratorResolver resolver = entry.getKey();
			if (resolver.matchPath(resourcePath)) {
				generator = (ResourceGenerator) ClassLoaderResourceUtils.buildObjectInstance(entry.getValue());
				if (!generator.getResolver().isSameAs(resolver)) {
					throw new BundlingProcessException("The resolver defined for " + generator.getClass().getName()
							+ " is different from the one expected by Jawr.");
				}

				if (resolver.getType().equals(ResolverType.PREFIXED)) {
					loadGeneratorIfNeeded(resolver.getResourcePath(resourcePath));
				}
			}
		}

		if (generator != null) {
			initGenerator(generator);
		}

		return generator;
	}
258095
public ProxyTarget locateProxyTarget() {
        if (bundleContext == null) {
            throw new IllegalStateException("Bundle context is not allowed to be null");
        }
        ClassLoader oldClassloader = Thread.currentThread().getContextClassLoader();
        String filter = getApplicationContextFilter(bundleContext.getBundle().getSymbolicName());
        ServiceReference<?>[] references = null;
        try {
            references = bundleContext.getServiceReferences(getContainerClass().getName(), filter);
        } catch (InvalidSyntaxException e) {
            throw new IllegalStateException("not possible", e);
        }
        if (references == null || references.length == 0) {
            throw new IllegalStateException(String.format("Found zero service references for %s; this is not OK...",
                bundleContext.getBundle().getSymbolicName()));
        }
        try {
            Thread.currentThread().setContextClassLoader(parent.getClassLoader());
            final BeanReactor<Container> strategy = createStrategy();
            for (ServiceReference<?> serviceReference : references) {
                @SuppressWarnings("unchecked")
                final Container service = (Container) bundleContext.getService(serviceReference);
                try {
                    if (!strategy.containsBean(service)) {
                        continue;
                    }
                    return new ProxyTarget() {

                        public Object getTarget() {
                            return strategy.createBean(service);
                        }
                    };
                } finally {
                    bundleContext.ungetService(serviceReference);
                }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(oldClassloader);
        }
        throw new IllegalStateException(String.format(
            "Bundle %s can no longer attach bean %s with ID %s, class %s to page %s", bundleContext
                .getBundle().getSymbolicName(), beanType.getName(), beanName, beanType.getName(),
            parent.getName()));
    }
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;
    }
641790
@Override
	public Reader getResource(JoinableResourceBundle bundle, String resourceName, boolean processingBundle,
			List<Class<?>> excludedReader) throws ResourceNotFoundException {

		if (ThreadLocalJawrContext.isInterruptingProcessingBundle()) {
			throw new InterruptBundlingProcessException();
		}
		Reader rd = null;

		String resourceExtension = FileNameUtils.getExtension(resourceName);
		boolean generatedPath = generatorRegistry.isPathGenerated(resourceName);
		if (generatedPath || allowedExtensions.contains(resourceExtension.toLowerCase())) {
			List<TextResourceReader> list = new ArrayList<>();
			list.addAll(resourceReaders);
			for (TextResourceReader rsReader : list) {
				if (!isInstanceOf(rsReader, excludedReader)) {
					if (!(rsReader instanceof ResourceGenerator)
							|| ((ResourceGenerator) rsReader).getResolver().matchPath(resourceName)) {
						try {
							rd = rsReader.getResource(bundle, resourceName, processingBundle);
						} catch (Exception e) {
							if (LOGGER.isDebugEnabled()) {
								LOGGER.debug("An exception occured while trying to read resource '" + resourceName
										+ "'. Continuing with other readers. Error : ", e);
							} else if (LOGGER.isInfoEnabled()) {
								LOGGER.info("An exception occured while trying to read resource '" + resourceName
										+ "'. Continuing with other readers. Error : " + e.getMessage());
							}
						}
						if (rd != null) {
							break;
						}
					}
				}
			}
		} else {
			LOGGER.warn("The resource '" + resourceName + "' will not be read as its extension is not an allowed one.");
		}

		if (rd == null) {
			throw new ResourceNotFoundException(resourceName);
		}

		return rd;
	}
1098982
public static ResourceBundle getCurrentResourceBundle(String locale) {
		try {
			if (null != locale && !locale.isEmpty()) {
				return getCurrentResourceBundle(LocaleUtils.toLocale(locale));
			}
		} catch (IllegalArgumentException ex) {
			// do nothing
		}
		return getCurrentResourceBundle((Locale) null);
	}
693712
private static @CheckForNull ResourceBundle getBundle(@Nonnull String baseName, @Nonnull Locale locale, @Nonnull ClassLoader classLoader) {
        try {
            return ResourceBundle.getBundle(baseName, locale, classLoader);
        } catch (MissingResourceException e) {
            // fall through and return null.
            logger.finer(e.getMessage());
        }
        return null;
    }
1196209
public static String getResourceInstitution(String resourceId)
	{
		Resource resource = getResource(resourceId);
    	return resource.getDataInstitution();
	}
985325
public void selectResource(String resourcePath, CmsUUID structureId, String title, String resourceType) {

        m_controller.selectResource(resourcePath, structureId, title, resourceType);
    }
1016169
@Override
	public String getFilePath(String resourcePath) {
		return helper.getFilePath(resolver.getResourcePath(resourcePath));
	}
18584
protected void closeTargetResource(
            CompensatingTransactionHolderSupport transactionHolderSupport) {
        DirContextHolder contextHolder = (DirContextHolder) transactionHolderSupport;
        DirContext ctx = contextHolder.getCtx();

        try {
            LOG.debug("Closing target context");
            ctx.close();
        } catch (NamingException e) {
            LOG.warn("Failed to close target context", e);
        }
    }
504295
@Override
	public ResourceBundlePathsIterator getGlobalResourceBundlePaths(
			ConditionalCommentCallbackHandler commentCallbackHandler, Map<String, String> variants) {

		return getBundleIterator(getDebugMode(), globalBundles, commentCallbackHandler, variants);
	}
986568
public static function locateResource($path, ContainerBuilder $container)
    {
        if (0 === stripos($path, '@')) {
            // Treat as a bundle path, e.g. @SomeBundle/path/to/something.

            // Correct backslashed paths.
            $path = str_replace('\\', '/', $path);

            $parts = explode('/', $path);
            $bundle = array_shift($parts);

            $bundleName = str_replace('@', '', $bundle);
            $bundleClass = null;
            foreach ($container->getParameter('kernel.bundles') as $name => $class) {
                if ($name === $bundleName) {
                    $bundleClass = $class;
                    break;
                }
            }

            if (null === $bundleClass) {
                throw new \RuntimeException(sprintf('Unable to find a bundle named "%s" for resource path "%s"', $bundleName, $path));
            }

            $refl = new \ReflectionClass($bundleClass);
            $bundleDir = dirname($refl->getFileName());
            return sprintf('%s/%s', $bundleDir, implode('/', $parts));
        }
        return $path;
    }
1151639
public static ResourceBundle getResourceBundle(File location, String name, Locale locale) {
        File[] files = new File[] { new File(location, name + "_" + locale.toString() + RESOURCE_FILE_EXT),
                                   new File(location, name + "_" + locale.getLanguage() + RESOURCE_FILE_EXT),
                                   new File(location, name + RESOURCE_FILE_EXT) };
        for (File file : files) {
            if (exists(file)) {
                try {
                    return new PropertyResourceBundle(new FileReader(file));
                } catch (IOException e) {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.fine("The resource file was not loaded. The exception is " + e.getMessage());
                    }
                }
            }
        }
        return null;
    }