Determines the name to be used for the provided resource.

@param resource the resource to get the name for
@return the name of the resource
168084
protected String determineResourceName(final Resource resource) {
        String resourceName = null;

        if (resource instanceof ContextResource) {
            resourceName = ((ContextResource) resource).getPathWithinContext();

        } else if (resource instanceof ByteArrayResource) {
            resourceName = resource.getDescription();

        } else {
            try {
                resourceName = resource.getFile().getAbsolutePath();
            } catch (IOException e) {
                resourceName = resource.getFilename();
            }
        }
        return resourceName;
    }
50859
public static URL getResource(String resource, Class<?> baseClass) {
		return (null != baseClass) ? baseClass.getResource(resource) : ClassLoaderUtil.getClassLoader().getResource(resource);
	}
306575
protected String toFilename(final Resource resource) throws UnsupportedOperationException {
        if (resource instanceof FileResource) {
            return ((FileResource) resource).getFile().getPath();
        }
        if (resource instanceof HadoopResource) {
            return ((HadoopResource) resource).getTemplatedPath();
        }
        if (resource instanceof HdfsResource) {
            return resource.getQualifiedPath();
        }
        if (resource instanceof UrlResource) {
            return resource.getQualifiedPath();
        }
        throw new UnsupportedOperationException("Unsupported resource type: " + resource);
    }
1168943
private static String getLogManagerLoggerName(final String name) {
        return (name.equals(RESOURCE_NAME) ? CommonAttributes.ROOT_LOGGER_NAME : name);
    }
7885
public Set<String> getResourceNames() {
		Set<String> resourceNames = new HashSet<>();

		if (myNameToResourceDefinition.isEmpty()) {
			Properties props = new Properties();
			try {
				props.load(myVersion.getFhirVersionPropertiesFile());
			} catch (IOException theE) {
				throw new ConfigurationException("Failed to load version properties file");
			}
			Enumeration<?> propNames = props.propertyNames();
			while (propNames.hasMoreElements()) {
				String next = (String) propNames.nextElement();
				if (next.startsWith("resource.")) {
					resourceNames.add(next.substring("resource.".length()).trim());
				}
			}
		}

		for (RuntimeResourceDefinition next : myNameToResourceDefinition.values()) {
			resourceNames.add(next.getName());
		}

		return Collections.unmodifiableSet(resourceNames);
	}
501228
protected String toFilename(final Resource resource) throws UnsupportedOperationException {
        if (resource instanceof FileResource) {
            return ((FileResource) resource).getFile().getPath();
        }

        throw new UnsupportedOperationException("Unsupported resource type: " + resource);
    }
1261869
def get_resource_name(meta):
    
    if meta.name is None and not meta.is_model:
        msg = "Either name or model for resource.Meta shoud be provided"
        raise ValueError(msg)

    name = meta.name or get_model_name(get_concrete_model(meta.model))
    return name
1267865
public static File getResourceAsFile(String resource) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            return new File(URLDecoder.decode(cl.getResource(resource)
                    .getFile(), "UTF-8"));
        } catch (UnsupportedEncodingException uee) {
            return null;
        }
    }
950903
@Override
    public String getName() {
        if (name == null) {
            return null;
        }
        if (name.endsWith("_INDEX_2")) {
            return removeEnd(name, "_INDEX_2");
        }
        return name;
    }
919788
public String getName()
    {
        if (_name==null)
        {
            _name=this.getClass().getName();
            if (!log.isDebugEnabled())
                _name=_name.substring(_name.lastIndexOf('.')+1);
        }
        return _name;
    }
400105
public static URL getResourceURL(String resource) throws IOException {
    URL url = null;
    ClassLoader loader = ResourcesUtils.class.getClassLoader();
    if (loader != null) {
      url = loader.getResource(resource);
    }
    if (url == null) {
      url = ClassLoader.getSystemResource(resource);
    }
    if (url == null) {
      throw new IOException("Could not find resource " + resource);
    }
    return url;
  }
167599
public String getRootPath(Resource resource) {
    int rootLevel = urlHandlerConfig.getSiteRootLevel(resource);
    if (rootLevel > 0) {
      return Path.getAbsoluteParent(resource.getPath(), rootLevel, resource.getResourceResolver());
    }
    return null;
  }
745981
public static ORule.ResourceGeneric getResourceGeneric(String name)
	{
		String shortName = Strings.beforeFirst(name, '.');
		if(Strings.isEmpty(shortName)) shortName = name;
		ORule.ResourceGeneric value = ORule.ResourceGeneric.valueOf(shortName);
		if(value==null) value = ORule.mapLegacyResourceToGenericResource(name);
		return value;
	}
319930
private static String convertResourceName(Class<?> klass, String resource) {
        if (resource.startsWith("/")) {
            // "absolute" resource, chop the slash
            return resource.substring(1);
        } else {
            String className = klass.getName();
            int i = className.lastIndexOf('.');
            if (i < 0) {
                // no package
                return resource;
            } else {
                // need to be relative to the package
                String packageName = className.substring(0, i);
                String packagePath = packageName.replace('.', '/');
                return packagePath + "/" + resource;
            }
        }
    }
664696
@NotNull
    @Size(max = 100)
    @ApiModelProperty(required = true, value = "")
    public String getName() {
        return name;
    }
591175
static String determineResourceName(final AttachmentResource attachmentResource, final boolean includeExtension) {
		final String datasourceName = attachmentResource.getDataSource().getName();

		String resourceName;

		if (!valueNullOrEmpty(attachmentResource.getName())) {
			resourceName = attachmentResource.getName();
		} else if (!valueNullOrEmpty(datasourceName)) {
			resourceName = datasourceName;
		} else {
			resourceName = "resource" + UUID.randomUUID();
		}
		if (includeExtension && !valueNullOrEmpty(datasourceName)) {
			@SuppressWarnings("UnnecessaryLocalVariable")
			final String possibleFilename = datasourceName;
			if (!resourceName.contains(".") && possibleFilename.contains(".")) {
				final String extension = possibleFilename.substring(possibleFilename.lastIndexOf("."));
				if (!resourceName.endsWith(extension)) {
					resourceName += extension;
				}
			}
		} else if (!includeExtension && resourceName.contains(".") && resourceName.equals(datasourceName)) {
			final String extension = resourceName.substring(resourceName.lastIndexOf("."));
			resourceName = resourceName.replace(extension, "");
		}
		return resourceName;
	}
781320
public static String getResourceUri(Resource resource) {
        try {
            return resource.getURI().toString();
        } catch (FileNotFoundException e) {
            return resource.getDescription();
        } catch (IOException e) {
            throw new RuntimeException("Could not create URI for resource: " + resource, e);
        }
    }