Creates a resource type from the OC_RESOURCE_TYPE environment variable.

<p>OC_RESOURCE_TYPE: A string that describes the type of the resource prefixed by a domain
namespace, e.g. “kubernetes.io/container”.
491971
@Nullable
  static String parseResourceType(@Nullable String rawEnvType) {
    if (rawEnvType != null && !rawEnvType.isEmpty()) {
      Utils.checkArgument(isValidAndNotEmpty(rawEnvType), "Type" + ERROR_MESSAGE_INVALID_CHARS);
      return rawEnvType.trim();
    }
    return rawEnvType;
  }
700204
public static final String printResourceType(ResourceType value)
   {
      return (Integer.toString(value == null ? ResourceType.WORK.getValue() : value.getValue()));
   }
1200762
private CmsMessageBundleEditorTypes.BundleType initBundleType() {

        String resourceTypeName = OpenCms.getResourceManager().getResourceType(m_resource).getTypeName();
        return CmsMessageBundleEditorTypes.BundleType.toBundleType(resourceTypeName);
    }
715489
public List<String> getFreeNodesForType(ResourceType type) {
    ArrayList<String> freeNodes = new ArrayList<String>();
    for (Map.Entry<String, ClusterNode> entry: nameToNode.entrySet()) {
      ClusterNode node = entry.getValue();
      synchronized (node) {
        if (!node.deleted &&
            node.getMaxCpuForType(type) > node.getAllocatedCpuForType(type)) {
          freeNodes.add(entry.getKey() + ": " + node.getFree().toString());
        }
      }
    }
    return freeNodes;
  }
69318
public void setType(String typeName) {

        try {
            try {
                m_type = OpenCms.getResourceManager().getResourceType(typeName);
            } catch (CmsLoaderException e) {
                // TODO: what happens if the resource type is a specialized folder and is not configured??
                int plainId;
                try {
                    plainId = OpenCms.getResourceManager().getResourceType(
                        CmsResourceTypePlain.getStaticTypeName()).getTypeId();
                } catch (CmsLoaderException e1) {
                    // this should really never happen
                    plainId = CmsResourceTypePlain.getStaticTypeId();
                }
                m_type = OpenCms.getResourceManager().getResourceType(plainId);
            }
            if (m_type.isFolder()) {
                // ensure folders end with a "/"
                if (!CmsResource.isFolder(m_destination)) {
                    m_destination += "/";
                }
            }
        } catch (Throwable e) {
            setThrowable(e);
        }
    }
1296828
public static Resource getResourceByType(int resourceType) {
    for (Resource resource : Resources.values()) {
      if (resource.resourceType() == resourceType) {
        return resource;
      }
    }
    return null;
  }
895750
@Override
   @SuppressWarnings("unchecked")
   public <E, T extends Resource<E>> T getChildOfType(final Class<T> type, final String name) throws ResourceException
   {
      T result;
      Resource<?> child = getChild(name);
      if (type.isAssignableFrom(child.getClass()))
      {
         result = (T) child;
      }
      else if (child.exists())
      {
         throw new ResourceException("Requested resource [" + name + "] was not of type [" + type.getName()
                  + "], but was instead [" + child.getClass().getName() + "]");
      }
      else
      {
         E underlyingResource = (E) child.getUnderlyingResourceObject();
         result = getResourceFactory().create(type, underlyingResource);
      }
      return result;
   }
439484
public String getResourceType() {
        if (resourceType == null) {
            resourceType = "";
            String type = resource.getResourceType();
            if (StringUtils.isBlank(type) || getPrimaryType().equals(type)) {
                Resource contentResource = getContentResource();
                if (contentResource != null) {
                    type = contentResource.getResourceType();
                    if (StringUtils.isNotBlank(type)) {
                        ResourceHandle handle = ResourceHandle.use(contentResource);
                        if (type.equals(handle.getPrimaryType())) {
                            type = null;
                        }
                    }
                }
            }
            if (StringUtils.isNotBlank(type)) {
                // check for a real existing resource type
                if (!Resource.RESOURCE_TYPE_NON_EXISTING.equals(type)) {
                    resourceType = type;
                }
            }
        }
        return resourceType;
    }
581727
def make_resource_handle(self, resource_key, **variables):
        
        if variables.get("repository_type", self.name()) != self.name():
            raise ResourceError("repository_type mismatch - requested %r, "
                                "repository_type is %r"
                                % (variables["repository_type"], self.name()))

        variables["repository_type"] = self.name()

        if variables.get("location", self.location) != self.location:
            raise ResourceError("location mismatch - requested %r, repository "
                                "location is %r" % (variables["location"],
                                                    self.location))
        variables["location"] = self.location

        resource_cls = self.pool.get_resource_class(resource_key)
        variables = resource_cls.normalize_variables(variables)
        return ResourceHandle(resource_key, variables)
887260
private static FileResource getFileResourceProto(final String fileName, final FileType type) throws IOException {
    File file = new File(fileName);
    if (file.exists()) {
      // It is a local file and can be added.
      if (file.isDirectory()) {
        // If it is a directory, create a JAR file of it and add that instead.
        file = toJar(file);
      }
      return FileResourceImpl.newBuilder()
          .setName(file.getName())
          .setPath(file.getPath())
          .setType(type)
          .build();
    } else {
      // The file isn't in the local filesytem. Assume that the file is actually a URI.
      // We then assume that the underlying resource manager knows how to deal with it.
      try {
        final URI uri = new URI(fileName);
        final String path = uri.getPath();
        final String name = path.substring(path.lastIndexOf('/') + 1);
        return FileResourceImpl.newBuilder()
            .setName(name)
            .setPath(uri.toString())
            .setType(type)
            .build();
      } catch (final URISyntaxException e) {
        throw new IOException("Unable to parse URI.", e);
      }
    }
  }
518764
private int getType(Resource file) {
	if (transferMode == FTPConstant.TRANSFER_MODE_BINARY) return AFTPClient.FILE_TYPE_BINARY;
	else if (transferMode == FTPConstant.TRANSFER_MODE_ASCCI) return AFTPClient.FILE_TYPE_TEXT;
	else {
	    String ext = ResourceUtil.getExtension(file, null);
	    if (ext == null || ListUtil.listContainsNoCase(ASCIIExtensionList, ext, ";", true, false) == -1) return AFTPClient.FILE_TYPE_BINARY;
	    return AFTPClient.FILE_TYPE_TEXT;
	}
    }
1271092
private ResourceType getResourceType(String resourceTag) {
        if (resourceTag == null || !resourceTag.endsWith("-resource")) {
            return ResourceType.unknown;
        }

        try {
            return ResourceType.valueOf(resourceTag.substring(0, resourceTag.length() - 9));
        } catch (Exception e) {
            return ResourceType.unknown;
        }
    }
101244
public ResourceRepository<Resource, String> getRepositoryForPath(String resourceType) {
        init();

        ResourceInformation resourceInformation =
                new ResourceInformation(
                        moduleRegistry.getTypeParser()
                        , Resource.class
                        , resourceType
                        , null
                        , null
                        , PagingSpec.class
                );
        return (ResourceRepository<Resource, String>) decorate(new ResourceRepositoryStubImpl<>(this, Resource.class, resourceInformation, urlBuilder));
    }
1262760
private synchronized void initResourceType(
        I_CmsResourceType resourceType,
        CmsResourceManagerConfiguration configuration) {

        // add the loader to the internal list of loaders
        configuration.addResourceType(resourceType);
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(
                Messages.get().getBundle().key(
                    Messages.INIT_ADD_RESTYPE_3,
                    resourceType.getTypeName(),
                    new Integer(resourceType.getTypeId()),
                    resourceType.getClass().getName()));
        }

        // add the mappings
        List<String> mappings = resourceType.getConfiguredMappings();
        Iterator<String> i = mappings.iterator();
        while (i.hasNext()) {
            String mapping = i.next();
            // only add this mapping if a mapping with this file extension does not
            // exist already
            if (!configuration.m_extensionMappings.containsKey(mapping)) {
                configuration.m_extensionMappings.put(mapping, resourceType.getTypeName());
                if (CmsLog.INIT.isInfoEnabled()) {
                    CmsLog.INIT.info(
                        Messages.get().getBundle().key(
                            Messages.INIT_MAP_RESTYPE_2,
                            mapping,
                            resourceType.getTypeName()));
                }
            }
        }
    }
898107
public RequestedNode resolve(String host, ResourceType type) {
    RunnableIndices indices = typeToIndices.get(type);
    return indices.getOrCreateRequestedNode(host);
  }
1176451
public static IndexedContainer getResourceTypesContainer() {

        IndexedContainer types = new IndexedContainer();
        types.addContainerProperty(PropertyId.caption, String.class, null);
        types.addContainerProperty(PropertyId.icon, Resource.class, null);
        types.addContainerProperty(PropertyId.isFolder, Boolean.class, null);
        types.addContainerProperty(PropertyId.isXmlContent, Boolean.class, null);
        for (I_CmsResourceType type : getResourceTypes()) {
            CmsExplorerTypeSettings typeSetting = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
                type.getTypeName());
            Item typeItem = types.addItem(type);
            typeItem.getItemProperty(PropertyId.caption).setValue(CmsVaadinUtils.getMessageText(typeSetting.getKey()));
            typeItem.getItemProperty(PropertyId.icon).setValue(CmsResourceUtil.getSmallIconResource(typeSetting, null));
            typeItem.getItemProperty(PropertyId.isXmlContent).setValue(
                Boolean.valueOf(type instanceof CmsResourceTypeXmlContent));
            typeItem.getItemProperty(PropertyId.isFolder).setValue(
                Boolean.valueOf(type instanceof A_CmsResourceTypeFolderBase));
        }

        return types;
    }
441826
function ResourceType(typeSpec) {
  this.include = typeSpec.include;
  if (this.include !== Resource.TYPE_SCRIPT &&
      this.include !== Resource.TYPE_CSS &&
      this.include != null) {
    throw new Error('invalid include property: ' + this.include);
  }
}