Returns the localized name for a given publish group based on its age.<p>

@param resources the resources of the publish group
@param age the age of the publish group

@return the localized name of the publish group
166177
public String getPublishGroupName(List<RESOURCE> resources, GroupAge age) {

        long groupDate = getDateLastModified(resources.get(0));
        String groupName;
        switch (age) {
            case young:
                groupName = Messages.get().getBundle(m_locale).key(
                    Messages.GUI_GROUPNAME_SESSION_1,
                    new Date(groupDate));

                break;
            case medium:
                groupName = Messages.get().getBundle(m_locale).key(Messages.GUI_GROUPNAME_DAY_1, new Date(groupDate));
                break;
            case old:
            default:
                groupName = Messages.get().getBundle(m_locale).key(Messages.GUI_GROUPNAME_EVERYTHING_ELSE_0);
                break;
        }
        return groupName;
    }
713113
@Override
	public Reader getResource(String resourceName) throws ResourceNotFoundException {

		return getResource(null, resourceName, false);
	}
732335
public ResourceBundle findResourceBundle(String resourcePath, Locale locale, String versionRange)
    {
        //if (ClassServiceBootstrap.repositoryAdmin == null)
        //    return null;

        ResourceBundle resourceBundle = this.getResourceBundleFromBundle(null, resourcePath, locale, versionRange);

        if (resourceBundle == null) {
            Object resource = this.deployThisResource(ClassFinderActivator.getPackageName(resourcePath, true), versionRange, false);
            if (resource != null)
            {
            	resourceBundle = this.getResourceBundleFromBundle(resource, resourcePath, locale, versionRange);
            	if (resourceBundle == null)
            	{
            		Class<?> c = this.getClassFromBundle(resource, resourcePath, versionRange);
            		if (c != null)
            		{
					   try {
						   resourceBundle = (ResourceBundle)c.newInstance();
					   } catch (InstantiationException e)   {
					       e.printStackTrace();	// Never
					   } catch (IllegalAccessException e)   {
					       e.printStackTrace();	// Never
					   } catch (Exception e) {
					       e.printStackTrace();	// Never
					   }            			
            		}
            	}
            }
        }

        return resourceBundle;
    }
629920
public String getLocalizedName(CmsMessages messages) {

        String nameKey = "GUI_RELATION_TYPE_" + getName() + "_0";
        return messages.key(nameKey);
    }
1286713
protected List<CmsUUID> parseResources(String resources) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(resources)) {
            return Collections.emptyList();
        } else {
            List<CmsUUID> result = new ArrayList<CmsUUID>();
            String[] resArray = resources.trim().split(";");
            for (int i = 0; i < resArray.length; i++) {
                result.add(new CmsUUID(resArray[i]));
            }
            return result;
        }
    }
903249
public URL getResource(String resourceName, BeanContextChild child)
	{
		if (resourceName == null || child == null)
		{
			throw new NullPointerException();
		}
		if (!contains(child))
		{
			throw new IllegalArgumentException(Messages.getString("beans.6D"));
		}

		return ClassLoader.getSystemResource(resourceName);
	}
773033
public CmsLocaleGroup readDefaultFileLocaleGroup(CmsResource resource) throws CmsException {

        if (resource.isFolder()) {
            CmsResource defaultFile = m_cms.readDefaultFile(resource, CmsResourceFilter.IGNORE_EXPIRATION);
            if (defaultFile != null) {
                return readLocaleGroup(defaultFile);
            } else {
                LOG.warn("default file not found, reading locale group of folder.");
            }
        }
        return readLocaleGroup(resource);

    }
435932
public static String lookup(String resourceName) {
        String resource = null;

        // 1. Check in the JNDI tree
        Context ctx = null;
        try {
            ctx = (Context) new InitialContext().lookup(JNDI_ENVIRONMENT);
            resource = (String) ctx.lookup(resourceName);
        }
        catch (NamingException ignore) {}

        // 2. Check among system properties
        if (null == resource || resource.length() == 0) {
            System.out.println("Resource \"" + resourceName + "\" not published through JNDI...");
            try {
                resource = System.getProperty(resourceName);
            }
            catch (Exception ignore) {}
        }

        if (null == resource || resource.length() == 0) {
            System.out.println("Resource \"" + resourceName + "\" not published through system properties...");
        }
        return resource;
    }
983946
public static Locale getMainLocale(CmsObject cms, CmsResource res) {

        CmsLocaleManager localeManager = OpenCms.getLocaleManager();
        List<Locale> defaultLocales = null;
        // must switch project id in stored Admin context to match current project
        String defaultNames = null;
        try {
            defaultNames = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_LOCALE, true).getValue();
        } catch (CmsException e) {
            LOG.warn(e.getLocalizedMessage(), e);
        }
        if (defaultNames != null) {
            defaultLocales = localeManager.getAvailableLocales(defaultNames);
        }

        if ((defaultLocales == null) || (defaultLocales.isEmpty())) {
            // no default locales could be determined
            defaultLocales = localeManager.getDefaultLocales();
        }
        Locale locale;
        // return the first default locale name
        if ((defaultLocales != null) && (defaultLocales.size() > 0)) {
            locale = defaultLocales.get(0);
        } else {
            locale = CmsLocaleManager.getDefaultLocale();
        }
        return locale;
    }
1183969
public static List<Resource> getChildrenByResourceType(final Resource resource, String resourceType) {
        final ArrayList<Resource> children = new ArrayList<>();
        if (resource != null) {
            for (final Resource child : resource.getChildren()) {
                if (child.isResourceType(resourceType)) {
                    children.add(child);
                }
            }
        }
        return children;
    }
1125465
public I_CmsResourceType getResourceType() {

        if (m_resourceType == null) {
            m_resourceType = OpenCms.getResourceManager().getResourceType(m_resource);
        }
        return m_resourceType;
    }
382313
public String getDisplayName(Locale locale) {

        if (getParentFqn() == null) {
            // for the root ou
            return getDescription(locale);
        }
        return Messages.get().getBundle(locale).key(
            Messages.GUI_ORGUNIT_DISPLAY_NAME_2,
            getDescription(locale),
            CmsOrganizationalUnit.SEPARATOR + getName());
    }
1363300
private List<I_CmsResourceType> convertTypeNamesToTypes(List<String> resourceTypes) {

        List<I_CmsResourceType> result = new ArrayList<I_CmsResourceType>();
        if (resourceTypes != null) {
            for (String type : resourceTypes) {
                try {
                    result.add(getResourceManager().getResourceType(type.trim()));
                } catch (Exception e) {
                    logError(e);
                }
            }
        }

        return result;
    }
1291907
public CmsLocaleGroup readLocaleGroup(CmsResource resource) throws CmsException {

        if (resource.isFolder()) {
            CmsResource defaultFile = m_cms.readDefaultFile(resource, CmsResourceFilter.IGNORE_EXPIRATION);
            if (defaultFile != null) {
                resource = defaultFile;
            }
        }

        List<CmsRelation> relations = m_cms.readRelations(
            CmsRelationFilter.ALL.filterType(CmsRelationType.LOCALE_VARIANT).filterStructureId(
                resource.getStructureId()));
        List<CmsRelation> out = Lists.newArrayList();
        List<CmsRelation> in = Lists.newArrayList();
        for (CmsRelation rel : relations) {
            if (rel.getSourceId().equals(resource.getStructureId())) {
                out.add(rel);
            } else {
                in.add(rel);
            }
        }
        CmsResource primaryResource = null;
        List<CmsResource> secondaryResources = Lists.newArrayList();
        if ((out.size() == 0) && (in.size() == 0)) {
            primaryResource = resource;
        } else if ((out.size() == 0) && (in.size() > 0)) {
            primaryResource = resource;
            // resource is the primary variant
            for (CmsRelation relation : in) {
                CmsResource source = relation.getSource(m_cms, CmsResourceFilter.ALL);
                secondaryResources.add(source);
            }
        } else if ((out.size() == 1) && (in.size() == 0)) {

            CmsResource target = out.get(0).getTarget(m_cms, CmsResourceFilter.ALL);
            primaryResource = target;
            CmsRelationFilter filter = CmsRelationFilter.TARGETS.filterType(
                CmsRelationType.LOCALE_VARIANT).filterStructureId(target.getStructureId());
            List<CmsRelation> relationsToTarget = m_cms.readRelations(filter);
            for (CmsRelation targetRelation : relationsToTarget) {
                CmsResource secondaryResource = targetRelation.getSource(m_cms, CmsResourceFilter.ALL);
                secondaryResources.add(secondaryResource);
            }
        } else {
            throw new IllegalStateException(
                "illegal locale variant relations for resource with id="
                    + resource.getStructureId()
                    + ", path="
                    + resource.getRootPath());
        }
        return new CmsLocaleGroup(m_cms, primaryResource, secondaryResources);
    }
1086414
public static String getClassName(String resourceName)
    {
        String className = resourceName.replace(File.separatorChar, '.');
        if (className.length() > 7)
        {
            className = className.substring(0, className.length() - 6);
        }
        return className;
    }
1119471
@Override
	public Reader getResource(JoinableResourceBundle bundle, String resourceName, boolean processingBundle) {

		Locale locale = null;
		String path = generator.getResolver().getResourcePath(resourceName);

		Map<String, String> contextVariants = new HashMap<>();
		Map<String, VariantSet> variantSets = new HashMap<>();
		if (generator instanceof VariantResourceGenerator || generator instanceof LocaleAwareResourceGenerator) {

			int variantSuffixIdx = path.indexOf("@");
			if (variantSuffixIdx != -1) {

				String variantKey = path.substring(path.indexOf('@') + 1);

				// Remove variant suffix
				path = path.substring(0, variantSuffixIdx);

				String[] variants = variantKey.split("@");
				if (generator instanceof VariantResourceGenerator) {
					variantSets = ((VariantResourceGenerator) generator).getAvailableVariants(path);
				} else { // instanceof LocaleAwareResourceGenerator
					List<String> availableLocales = ((LocaleAwareResourceGenerator) generator)
							.getAvailableLocales(path);
					if (availableLocales != null) {
						variantSets.put(JawrConstant.LOCALE_VARIANT_TYPE,
								new VariantSet(JawrConstant.LOCALE_VARIANT_TYPE, "", availableLocales));
					}
				}

				// Sort the variant types
				List<String> variantTypes = new ArrayList<>(variantSets.keySet());
				Collections.sort(variantTypes);
				int nbVariants = variants.length;

				for (int i = 0; i < nbVariants; i++) {
					String variantType = variantTypes.get(i);
					String variantValue = variants[i];
					contextVariants.put(variantType, variantValue);
					if (variantType.equals(JawrConstant.LOCALE_VARIANT_TYPE)) {
						// Resourcebundle should be doing this for me...
						String[] params = variantValue.split("_");
						switch (params.length) {
						case 3:
							locale = new Locale(params[0], params[1], params[2]);
							break;
						case 2:
							locale = new Locale(params[0], params[1]);
							break;
						default:
							locale = new Locale(variantValue);
						}
					}
				}
			}
		}

		GeneratorContext context = new GeneratorContext(bundle, config, path);
		context.setVariantMap(contextVariants);
		context.setVariantSets(variantSets);

		context.setLocale(locale);
		context.setResourceReaderHandler(rsHandler);
		context.setProcessingBundle(processingBundle);

		return generator.createResource(context);
	}
1323327
public static String getStaticResourceUri(String resourceName, String versionInfo) {

        resourceName = CmsStaticResourceHandler.removeStaticResourcePrefix(resourceName);
        String uri = CmsStringUtil.joinPaths(OpenCms.getSystemInfo().getStaticResourceContext(), resourceName);
        if (versionInfo != null) {
            uri += "?v=" + versionInfo;
        }
        return uri;
    }