Replies if the given resource is a script.

@param resource the resource to test.
@return <code>true</code> if the given resource is a script.
544606
@SuppressWarnings("static-method")
	protected boolean isSourceFile(Resource resource) {
		if (resource instanceof BatchLinkableResource) {
			return !((BatchLinkableResource) resource).isLoadedFromStorage();
		}
		return false;
	}
921334
public static boolean isResourceTypeIdFree(int id) {

        try {
            OpenCms.getResourceManager().getResourceType(id);
        } catch (CmsLoaderException e) {
            return true;
        }
        return false;
    }
638495
public static boolean isFile(Resource resource) {
        Node node = resource.adaptTo(Node.class);
        if (node != null) {
            try {
                NodeType type = node.getPrimaryNodeType();
                if (type != null) {
                    String typeName = type.getName();
                    switch (typeName) {
                        case TYPE_FILE:
                            return true;
                        case TYPE_RESOURCE:
                        case TYPE_UNSTRUCTURED:
                            try {
                                Property mimeType = node.getProperty(PROP_MIME_TYPE);
                                if (mimeType != null && StringUtils.isNotBlank(mimeType.getString())) {
                                    node.getProperty(ResourceUtil.PROP_DATA);
                                    // PathNotFountException if not present
                                    return true;
                                }
                            } catch (PathNotFoundException pnfex) {
                                // ok, was a check only
                            }
                            break;
                    }
                }
            } catch (RepositoryException e) {
                LOG.error(e.getMessage(), e);
            }
        }
        return false;
    }
967834
public static void validateScriptsCombination(Set<XmLepResourceSubType> scriptTypes,
                                                  LepMethod lepMethod,
                                                  UrlLepResourceKey compositeResourceKey) {
        byte mask = getCombinationMask(scriptTypes, lepMethod, compositeResourceKey);

        StringBuilder errors = new StringBuilder();
        if (isZero(mask, ZERO_PATTERN_NO_TENANT_AND_DEFAULT_AND_JAVA_CODE)) {
            errors.append(String.format("Has no one script of '%s', '%s' or native (java) implementation.",
                                        XmLepResourceSubType.TENANT, XmLepResourceSubType.DEFAULT));
        }

        if (isSetByPattern(mask, IS_SET_PATTERN_AROUND_AND_BEFORE)) {
            if (errors.length() > 0) {
                errors.append(" ");
            }

            errors.append(String.format("Has '%s' script with '%s'.", XmLepResourceSubType.BEFORE, XmLepResourceSubType.AROUND));
        }

        if (isSetByPattern(mask, IS_SET_PATTERN_AROUND_AND_AFTER)) {
            if (errors.length() > 0) {
                errors.append(" ");
            }

            errors.append(String.format("Has '%s' script with '%s'.", XmLepResourceSubType.AROUND, XmLepResourceSubType.AFTER));
        }

        if (isSetByPattern(mask, IS_SET_PATTERN_AROUND_AND_TENANT)) {
            if (errors.length() > 0) {
                errors.append(" ");
            }

            errors.append(String.format("Unallowed combination '%s' and '%s' scripts.", XmLepResourceSubType.AROUND, XmLepResourceSubType.TENANT));
        }

        if (errors.length() > 0) {
            throw new IllegalArgumentException(String.format("Resource key %s has script combination errors. %s",
                                                             compositeResourceKey,
                                                             errors.toString()));

        }
    }
137135
public static TemplateBasedScriptBuilder fromTemplateResource(Resource scriptTemplateResource) {
        try {
            return new TemplateBasedScriptBuilder(FileUtils.readToString(scriptTemplateResource.getInputStream()));
        } catch (IOException e) {
            throw new CitrusRuntimeException("Error loading script template from file resource", e);
        }
    }
1270131
public boolean isResourceBundleMatch(Object objResource, Bundle bundle)
    {
    	Resource resource = (Resource)objResource;
    	return ((bundle.getSymbolicName().equals(resource.getSymbolicName())) && (isValidVersion(bundle.getVersion(), resource.getVersion().toString())));
    }
370094
def is_script(filename):
    '''
    '''
    if not os.path.isfile(filename):
        return False

    try:
        with open(filename, 'rb') as fp:
            return fp.read(2) == b'#!'
    except IOError:
        pass

    return False
115919
public static boolean isInHeader(final String scriptname) {
    final NodeList scriptList =
        Browser.getDocument().getHead().getElementsByTagName(JsResources.TAG_TYPE);
    for (int i = 0; i < scriptList.getLength(); i++) {
      final ScriptElement scriptTag = (ScriptElement) scriptList.item(i);
      if (StringUtils.contains(scriptTag.getSrc(), scriptname)) {
        return true;
      }
    }
    return false;
  }
1199064
public static boolean isFolder(String resource) {

        return CmsStringUtil.isNotEmpty(resource) && (resource.charAt(resource.length() - 1) == '/');
    }
119379
private boolean resourceExists(CmsObject cms, String resource) {

        try {
            cms.readResource(resource, CmsResourceFilter.ALL);
            return true;
        } catch (CmsException e) {
            return false;
        }
    }
519918
public static boolean isChildOf(Resource file, Resource dir) {
	while (file != null) {
	    if (file.equals(dir)) return true;
	    file = file.getParentResource();
	}
	return false;
    }
599712
function isSubComponent(resource) {
  const [dir, module] = resource.split('/').filter(n => n !== '.');
  return dir !== module;
}
1042747
public static String readScript(final String resourceName) throws IOException {
        final StringBuilder buf = new StringBuilder();
        try (final InputStream inputStream = ScriptUtils.class.getResourceAsStream(resourceName)) {
            if (inputStream == null) {
                throw new IOException("Could not find script resource: " + resourceName);
            }
            try (final BufferedReader reader = new BufferedReader(
                    new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
                String prefix = "";
                String line;
                while ((line = reader.readLine()) != null) {
                    line = line.trim();
                    if (line.length() > 0) {
                        buf.append(prefix).append(line.trim());
                        prefix = "\n";
                    }
                }
            }
        }
        return buf.toString();
    }
104517
public boolean contains(String resource) {
		boolean result = storage.contains(resource);
		logger.debug("resource '{}' {} in cache", resource, (result ? "is" : "is not"));
		return result; 
	}
1128589
public static boolean isResourcesOfResource(JavaType type) {

		return
			CollectionModel.class.isAssignableFrom(type.getRawClass())
			&&
			EntityModel.class.isAssignableFrom(type.containedType(0).getRawClass());
	}
1231346
private boolean isJarFile(URL resourceLocation) {

    String resourceLocationString = resourceLocation.toExternalForm();

    return resourceLocationString.startsWith("jar:file:") || resourceLocationString.contains(".jar!");
  }
639771
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

        // Get the script path from the request - include aware (GROOVY-815)
        final String scriptUri = getScriptUri(request);

        // Set it to HTML by default
        response.setContentType("text/html; charset="+encoding);

        // Set up the script context
        final ServletBinding binding = new ServletBinding(request, response, servletContext);
        setVariables(binding);

        // Run the script
        try {
            Closure closure = new Closure(gse) {

                public Object call() {
                    try {
                        return ((GroovyScriptEngine) getDelegate()).run(scriptUri, binding);
                    } catch (ResourceException | ScriptException e) {
                        throw new RuntimeException(e);
                    }
                }

            };
            GroovyCategorySupport.use(ServletCategory.class, closure);
        } catch (RuntimeException runtimeException) {
            StringBuilder error = new StringBuilder("GroovyServlet Error: ");
            error.append(" script: '");
            error.append(scriptUri);
            error.append("': ");
            Throwable e = runtimeException.getCause();
            /*
             * Null cause?!
             */
            if (e == null) {
                error.append(" Script processing failed.\n");
                error.append(runtimeException.getMessage());
                if (runtimeException.getStackTrace().length > 0)
                    error.append(runtimeException.getStackTrace()[0].toString());
                servletContext.log(error.toString());
                System.err.println(error.toString());
                runtimeException.printStackTrace(System.err);
                response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error.toString());
                return;
            }
            /*
             * Resource not found.
             */
            if (e instanceof ResourceException) {
                error.append(" Script not found, sending 404.");
                servletContext.log(error.toString());
                System.err.println(error.toString());
                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                return;
            }
            /*
             * Other internal error. Perhaps syntax?!
             */
            servletContext.log("An error occurred processing the request", runtimeException);
            error.append(e.getMessage());
            if (e.getStackTrace().length > 0)
                error.append(e.getStackTrace()[0].toString());
            servletContext.log(e.toString());
            System.err.println(e.toString());
            runtimeException.printStackTrace(System.err);
            response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
        }
    }