Creates an {@link IResource} object for the dependent feature list AMD
module

@param list
the dependent features list
@param uri
the resource URI
@param lastmod
the last modified time of the resource
@return the {@link IResource} object for the module
197497
protected IResource createFeatureListResource(List<String> list, URI uri, long lastmod) {
		JSONArray json;
		try {
			json = new JSONArray(new ArrayList<String>(dependentFeatures));
		} catch (JSONException ex) {
			return new ExceptionResource(uri, lastmod, new IOException(ex));
		}
		StringBuffer sb = new StringBuffer();
		sb.append(FEATURE_LIST_PRELUDE).append(json).append(FEATURE_LIST_PROLOGUE);
		IResource result = new StringResource(sb.toString(), uri, lastmod);
		return result;
	}
66337
@Override
    public <T> CachedResource<T> getResource(
            Resource resource, Loader<T> builder, long checkInterval) throws IOException {
        if (Included.PLAIN == this.resourcesElementsProvider.getDefaultIncludedType()) {
            this.logger.trace(
                    "Resoure Aggregation Disabled, ignoring resource cache and loading '"
                            + resource
                            + "' directly");
            return this.loadResource(resource, builder);
        }

        // Look for the resource in the cache, since it has been wrapped with a SelfPopulatingCache
        // it should never return null.
        final GetResourceArguments<T> arguments = new GetResourceArguments<T>(resource, builder);
        final Element element =
                this.entryFactory.getWithData(this.resourceCache, resource, arguments);

        CachedResource<T> cachedResource = (CachedResource<T>) element.getObjectValue();
        if (this.logger.isTraceEnabled()) {
            this.logger.trace("Found " + cachedResource + " in cache");
        }

        // Found it, now check if the last-load time is within the check interval
        final long lastCheckTime = cachedResource.getLastCheckTime();
        if (lastCheckTime + checkInterval >= System.currentTimeMillis()) {
            if (this.logger.isTraceEnabled()) {
                this.logger.trace(
                        cachedResource
                                + " is within checkInterval "
                                + checkInterval
                                + ", returning");
            }
            return cachedResource;
        }
        if (this.logger.isTraceEnabled()) {
            this.logger.trace(
                    cachedResource
                            + " is older than checkInterval "
                            + checkInterval
                            + ", checking for modification");
        }

        // If the resource has not been modified return the cached resource.
        final boolean resourceModified = this.checkIfModified(cachedResource);
        if (!resourceModified) {
            cachedResource.setLastCheckTime(System.currentTimeMillis());
            this.resourceCache.put(
                    element); // do a cache put to notify the cache the object has been modified
            return cachedResource;
        }

        // The resource has been modified, reload it.
        cachedResource = this.loadResource(resource, builder);

        // Cache the loaded resource
        this.resourceCache.put(new Element(resource, cachedResource));

        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Loaded and cached " + cachedResource);
        }

        return cachedResource;
    }
356832
public static Protos.CommandInfo.URI uri(MesosArtifactResolver resolver, ContainerSpecification.Artifact artifact) {
		checkNotNull(resolver);
		checkNotNull(artifact);
		Option<URL> url = resolver.resolve(artifact.dest);
		if (url.isEmpty()) {
			throw new IllegalArgumentException("Unresolvable artifact: " + artifact.dest);
		}

		return Protos.CommandInfo.URI.newBuilder()
			.setValue(url.get().toExternalForm())
			.setOutputFile(artifact.dest.toString())
			.setExtract(artifact.extract)
			.setCache(artifact.cachable)
			.setExecutable(artifact.executable)
			.build();
	}
347493
@Override
	public Resource createResource(URI uri) {
		XMLResource result = new BpsimResourceImpl(uri);
		result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
		result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);

		result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);

		result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
		result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);

		result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
		return result;
	}
399047
public static String getModulePathForRelativeURI( String uri )
    {
        if ( uri == null ) return null;
        assert uri.length() > 0;
        assert uri.charAt( 0 ) == '/' : uri;

        // Strip off the actual page name (e.g., some_page.jsp)
        int slash = uri.lastIndexOf( '/' );
        uri = uri.substring( 0, slash );

        return uri;
    }
1272552
public boolean isRuleDefined(final String iResource) {
		for (ORole r : roles)
			if (r.hasRule(iResource))
				return true;

		return false;
	}
55282
public static Resource createResource(Resource res, short level, short type) {

	boolean asDir = type == TYPE_DIR;
	// File
	if (level >= LEVEL_FILE && res.exists() && ((res.isDirectory() && asDir) || (res.isFile() && !asDir))) {
	    return getCanonicalResourceEL(res);
	}

	// Parent
	Resource parent = res.getParentResource();
	if (level >= LEVEL_PARENT_FILE && parent != null && parent.exists() && canRW(parent)) {
	    if (asDir) {
		if (res.mkdirs()) return getCanonicalResourceEL(res);
	    }
	    else {
		if (createNewResourceEL(res)) return getCanonicalResourceEL(res);
	    }
	    return getCanonicalResourceEL(res);
	}

	// Grand Parent
	if (level >= LEVEL_GRAND_PARENT_FILE && parent != null) {
	    Resource gparent = parent.getParentResource();
	    if (gparent != null && gparent.exists() && canRW(gparent)) {
		if (asDir) {
		    if (res.mkdirs()) return getCanonicalResourceEL(res);
		}
		else {
		    if (parent.mkdirs() && createNewResourceEL(res)) return getCanonicalResourceEL(res);
		}
	    }
	}
	return null;
    }
152852
protected Optional<IRI> extractIRI(ImmutableTerm term) {
        if (term instanceof IRIConstant) {
            return Optional.of(((IRIConstant) term).getIRI());
        }
        // TODO: look for the RDF building function (and check the type is an IRI)
        else if (term instanceof ImmutableFunctionalTerm) {
            return ((ImmutableFunctionalTerm) term).getArity() == 1
                    ? extractIRI(((ImmutableFunctionalTerm) term).getTerms().get(0))
                    : Optional.empty();
        }
        else if (term instanceof ValueConstant) {
            return Optional.of(rdfFactory.createIRI( ((ValueConstant) term).getValue()));
        }
        return Optional.empty();
    }
481664
@Nullable
  public static <T> T lastElement(@Nullable final List<T> list) {
    if (CollectionUtils.isEmpty(list)) {
      return null;
    }
    return list.get(list.size() - 1);
  }
726027
@Override
    URI getURI() {
        final URI uri = moduleRef.getLocation();
        if (uri == null) {
            // Some modules have no known module location (ModuleReference#location() can return null)
            throw new IllegalArgumentException("Module " + getModuleName() + " has a null location");
        }
        return uri;
    }
1322557
@Override
    public URL getPersistenceUnitRootUrl() {
        // Make one that is OSGi based, it relies on the 'location' property
        String loc = location;
        int n = loc.lastIndexOf('/');
        if (n > 0) {
            loc = loc.substring(0, n);
        }
        if (loc.isEmpty()) {
            loc = "/";
        }
        return sourceBundle.bundle.getResource(loc);
    }
726660
@Override
    public ApplicationDescriptor webModule(String uri, String contextRoot) {
        Node web = model.createChild("module").createChild("web");
        web.createChild("web-uri").text(uri);
        web.createChild("context-root").text(contextRoot);
        return this;
    }
687034
public ResourceModelSource createCachingSource(
            ResourceModelSource origin,
            String ident,
            String descr,
            SourceFactory.CacheType type,
            final boolean logging
    )
    {
        final File file = getResourceModelSourceFileCacheForType(ident);
        final ResourceModelSourceService nodesSourceService = resourceModelSourceService;
        final ResourceFormatGeneratorService resourceFormatGeneratorService = getResourceFormatGeneratorService();
        final Properties fileSourceConfig = generateFileSourceConfigurationProperties(
                file.getAbsolutePath(),
                ResourceXMLFormatGenerator.SERVICE_PROVIDER_TYPE, false, false
        );
        try {
            ResourceModelSource fileSource = nodesSourceService.getSourceForConfiguration("file", fileSourceConfig);

            ResourceFormatGenerator generatorForFormat = resourceFormatGeneratorService.getGeneratorForFormat
                    (ResourceXMLFormatGenerator.SERVICE_PROVIDER_TYPE);

            String ident1 = "[ResourceModelSource: " + descr + ", project: " + projectConfig.getName() + "]";
            StoreExceptionHandler handler = new StoreExceptionHandler(ident);
            ResourceModelSourceCache cache = new FileResourceModelSourceCache(
                    file,
                    generatorForFormat,
                    fileSource
            );
            if(logging) {
                cache = new LoggingResourceModelSourceCache(cache, ident1);
            }
            return SourceFactory.cachedSource(
                    origin,
                    ident1,
                    handler,
                    cache,
                    type
            );
        } catch (UnsupportedFormatException | ExecutionServiceException e) {
            e.printStackTrace();
        }
        return null;
    }
942499
private ResourceModelSource createCachingSource(
            ResourceModelSource origin,
            String ident,
            String descr
    )
    {
        return createCachingSource(origin, ident, descr, SourceFactory.CacheType.BOTH, true);
    }
914565
public ORole checkIfAllowed(final String iResource, final int iOperation) {
		for (ORole r : roles)
			if (r.allow(iResource, iOperation))
				return r;

		return null;
	}
1092710
public static String getHistoryResourceURI(String uri, ServletRequest req) {

        String histUri = uri;
        if (CmsHistoryResourceHandler.isHistoryRequest(req)) {
            String version = req.getParameter(CmsHistoryResourceHandler.PARAM_VERSION);
            histUri = CmsRequestUtil.appendParameter(uri, CmsHistoryResourceHandler.PARAM_VERSION, version);
        }
        return histUri;
    }
267451
public AbstractBuilder getModuleSummaryBuilder(ModuleElement mdle, ModuleElement prevModule,
            ModuleElement nextModule) {
        return ModuleSummaryBuilder.getInstance(context, mdle,
            writerFactory.getModuleSummaryWriter(mdle, prevModule, nextModule));
    }