Checks whether the given resource is a Java artifact (i.e. either a Java
source file or a Java class file).

@param resource
The resource to check.
@return <code>true</code> if the given resource is a Java artifact.
<code>false</code> otherwise.
767859
public static boolean isJavaArtifact(IResource resource) {
        if (resource == null || (resource.getType() != IResource.FILE)) {
            return false;
        }
        String ex = resource.getFileExtension();
        if ("java".equalsIgnoreCase(ex) || "class".equalsIgnoreCase(ex)) {
            return true;
        }
        String name = resource.getName();
        return Archive.isArchiveFileName(name);
    }
1010814
public static boolean isModelGroup(CmsResource resource) {

        return OpenCms.getResourceManager().getResourceType(resource).getTypeName().equals(MODEL_GROUP_TYPE_NAME);
    }
1338327
public static boolean isNavLevelFolder(CmsObject cms, CmsResource resource) {

        if (resource.isFolder()) {
            I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource);
            if (CmsResourceTypeFolder.RESOURCE_TYPE_NAME.equals(type.getTypeName())) {
                try {
                    CmsProperty prop = cms.readPropertyObject(
                        resource,
                        CmsPropertyDefinition.PROPERTY_DEFAULT_FILE,
                        false);
                    return !prop.isNullProperty() && NAVIGATION_LEVEL_FOLDER.equals(prop.getValue());
                } catch (CmsException e) {
                    LOG.debug(e.getMessage(), e);
                }
            }
        }
        return false;
    }
96344
private boolean containsIncompatibleResourceType() {
    if (queryByResourceType && queryByPermission) {
      Resource[] resources = resourcesIntersection.toArray(new Resource[resourcesIntersection.size()]);
      return !ResourceTypeUtil.resourceIsContainedInArray(resourceType, resources);
    }
    return false;
  }
627031
protected boolean isResourceInTimeWindow(CmsPublishedResource resource) {

        return m_cms.existsResource(
            m_cms.getRequestContext().removeSiteRoot(resource.getRootPath()),
            CmsResourceFilter.DEFAULT);
    }
327669
public static boolean doesResourceExist(final String resource, final ResourceLoader resourceLoader) {
        try {
            if (StringUtils.isNotBlank(resource)) {
                val res = resourceLoader.getResource(resource);
                return doesResourceExist(res);
            }
        } catch (final Exception e) {
            LOGGER.warn(e.getMessage(), e);
        }
        return false;
    }
293287
private boolean isInPaths(final CmsResource resource) {

        boolean result = false;
        String resourcePath = getCms().getSitePath(resource);
        for (String path : m_paths) {
            if (resourcePath.startsWith(path)) {
                result = true;
                break;
            }
        }
        return result;

    }
642215
public boolean containsResource (String path)
    {
        try {
            if (resolveJarFile()) {
                return false;
            }
            return (_jarSource.getJarEntry(path) != null);
        } catch (IOException ioe) {
            return false;
        }
    }
259691
public static boolean isFile(Resource file) {
	if (file.exists()) return file.isFile();
	Resource parent = file.getParentResource();
	return parent.mkdirs() && file.createNewFile();
    }
1301864
private static boolean isBundledInJre(String className) {
    if (className.startsWith("javax.accessibility.")
        || className.startsWith("javax.activation.")
        || className.startsWith("javax.activity.")
        || className.startsWith("javax.annotation.")
        || className.startsWith("javax.crypto.")
        || className.startsWith("javax.imageio.")
        || className.startsWith("javax.jws.")
        || className.startsWith("javax.lang.model.")
        || className.startsWith("javax.management.")
        || className.startsWith("javax.naming.")
        || className.startsWith("javax.net.")
        || className.startsWith("javax.print.")
        || className.startsWith("javax.rmi.")
        || className.startsWith("javax.script.")
        || className.startsWith("javax.security.")
        || className.startsWith("javax.sound.")
        || className.startsWith("javax.sql.")
        || className.startsWith("javax.swing.")
        || className.startsWith("javax.tools.")
        || className.startsWith("javax.transaction.")
        || className.startsWith("javax.xml.")) {
      return true;
    }
    return false;
  }
1319432
protected boolean resourceIsValid(CmsResource resource) {

        if (!resource.getRootPath().startsWith(m_basePath)) {
            return false;
        }
        if (m_requireFile & resource.isFolder()) {
            return false;
        }
        if (m_requireFolder & resource.isFile()) {
            return false;
        }
        return true;
    }
769473
public void setJavaSourceVersion(String version) {
		final JavaVersion javaVersion = JavaVersion.fromQualifier(version);
		if (javaVersion == null) {
			final List<String> qualifiers = new ArrayList<>();
			for (final JavaVersion vers : JavaVersion.values()) {
				qualifiers.addAll(vers.getAllQualifiers());
			}

			throw new RuntimeException(MessageFormat.format(
					Messages.SarlBatchCompiler_0, version, Joiner.on(Messages.SarlBatchCompiler_1).join(qualifiers)));
		}
		getGeneratorConfig().setJavaSourceVersion(javaVersion);
	}
674427
private String getResourceType(Resource resource)
   {
      String result;
      net.sf.mpxj.ResourceType type = resource.getType();
      if (type == null)
      {
         type = net.sf.mpxj.ResourceType.WORK;
      }

      switch (type)
      {
         case MATERIAL:
         {
            result = "Material";
            break;
         }

         case COST:
         {
            result = "Nonlabor";
            break;
         }

         default:
         {
            result = "Labor";
            break;
         }
      }

      return result;
   }
311781
public static boolean isFile(Node node)
   {
      try
      {
         if (!node.isNodeType("nt:file"))
            return false;
         if (!node.getNode("jcr:content").isNodeType("nt:resource"))
            return false;
         return true;
      }
      catch (RepositoryException exc)
      {
         LOG.error(exc.getMessage(), exc);
         return false;
      }
   }
867712
private boolean findJavaSourceFiles(String[] args) {
        String prev = "";
        for (String s : args) {
            if (s.endsWith(".java") && !prev.equals("-xf") && !prev.equals("-if")) {
                return true;
            }
            prev = s;
        }
        return false;
    }
996640
public static void ensureValidResource(JsonNode resource) {
		if (!resource.has(JSONAPISpecConstants.DATA) && !resource.has(JSONAPISpecConstants.META)) {
			throw new InvalidJsonApiResourceException();
		}
	}
261060
protected boolean isSourceFile(File file) {
        String name = file.getName();
        String extension = Files.getExtension(name).toLowerCase();
        return sourceFileExtensions.contains(extension) || sourceFileNames.contains(name);
    }