Provides the properties of the resource as a {@link PrimitiveSupportingValueMap}.

@param resource must not be <code>null</code>.
@return the value map, or <code>null</code> if the resource has no properties,
e.g. if it is synthetic.
497952
private static ValueMap toValueMap(Resource resource) {
        ValueMap propertyMap = resource.adaptTo(ValueMap.class);
        if (propertyMap != null) {
            propertyMap = new PrimitiveSupportingValueMap(propertyMap);
        }
        return propertyMap;
    }
582381
public static Map<String, Val> loads(@NonNull Resource resource) throws IOException {
      return loads(resource.readToString());
   }
759291
@SuppressWarnings("rawtypes")
    protected PropertiesHolder getProperties(final String filename, final Resource resource) {
	    return CacheEntry.getValue(cachedProperties, filename, fileCacheMillis, new Callable<PropertiesHolder>() {
            @Override
            public PropertiesHolder call() throws Exception {
                return new PropertiesHolder(filename, resource);
            }
        }, new Callable<CacheEntry>() {
            @Override
            public CacheEntry call() throws Exception {
                return new PropertiesHolderCacheEntry();
            }
        }, true, null);
	}
778945
public Map getMapOfValue(Object key) {
		for (Scope cur=this; cur!=null; cur=cur.parent) {
			if (cur.data != null && cur.data.containsKey(key)) {
				return cur.data;
			}
		}
		return null;
	}
946401
public static List<URL> getResources(String resource) {
		final Enumeration<URL> resources;
		try {
			resources = ClassLoaderUtil.getClassLoader().getResources(resource);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
		return CollectionUtil.newArrayList(resources);
	}
426899
protected boolean isInConditionResource(String resource){
		Resource sqlResource = context.getResource(resource);
		InputStream in = null;
		String sql = null;
		try{
			in = sqlResource.getInputStream();
			sql = IOUtils.toString(in);
		} catch(IOException ioe){
			throw new RuntimeException("Failed to get condition SQL (" + ioe.getMessage() + ") from: " + resource, ioe);
		}finally{
			IOUtils.closeQuietly(in);
		}
		if (StringUtils.isNotBlank(sql)){
			return isInCondition(sql);
		}else{
			return true;
		}
	}
932992
public Object newInstance(String resource) {
        try {
            String name = resource.startsWith("/") ? resource : "/" + resource;
            File file = new File(this.getClass().getResource(name).toURI());
            return newInstance(classLoader.parseClass(new GroovyCodeSource(file), true));
        } catch (Exception e) {
            throw new GroovyClassInstantiationFailed(classLoader, resource, e);
        }
    }
225631
@Override
	public Template getTemplate(String resource) {
		try {
			return FreemarkerTemplate.wrap(this.cfg.getTemplate(resource));
		} catch(IOException e) {
			throw new IORuntimeException(e);
		}catch (Exception e) {
			throw new TemplateException(e);
		}
	}
749743
public static Resource wrap(@NotNull Resource resource, @NotNull ValueMap valueMap) {
    return wrap(resource, valueMap, resource.getChildren());
  }
1093302
public static Properties readPropertiesFromClassLoader(String resource) {
        Properties properties = new Properties();
        try {
            properties.load(FsCrawlerUtil.class.getClassLoader().getResourceAsStream(resource));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return properties;
    }
799197
public static Object getPropertyValue( final Object root, final String... properties ) {



        Object object = root;



        for ( String property : properties ) {

            if (object == null) {
                return null;
            }

            if (property.equals("this")) {
                if (!(object instanceof Map)) {
                    continue;
                } else {
                    Object aThis = ((Map) object).get("this");
                    if (aThis!=null) {
                        object = aThis;
                        continue;
                    } else {
                        continue;
                    }
                }
            }

            if (object instanceof Map) {
                object = ((Map) object).get(property);
                continue;
            }


            char c = property.charAt(0);
            if ( CharScanner.isDigit(c) ) {
                /* We can index numbers and names. */
                object = idx ( object, StringScanner.parseInt ( property ) );

            } else {


                if (object instanceof Collection) {

                    object = _getFieldValuesFromCollectionOrArray( object, property);
                    continue;
                } else if (isArray(object)) {


                    Iterator iter = Conversions.iterator(object);
                    List list = Lists.list(iter);
                    object = _getFieldValuesFromCollectionOrArray(list, property);

                    continue;
                }


                Map<String, FieldAccess> fields =
                         getPropertyFieldAccessMap( object.getClass() );

                FieldAccess field = fields.get( property );

                if ( field == null ) {
                    return null;
                }

                object = field.getValue( object );
            }
        }
        return object;
    }
1076862
@Override
	public IResource convert(final IResource resource) {
		final String sourceMethod = "convert"; //$NON-NLS-1$
		final boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(sourceMethod, sourceMethod, new Object[]{resource});
		}
		IResource result = resource;

		if (!isSkipResourceConversion.get()) {
			if (!resource.isFolder()) {
				// is the request for a JavaScript file
				if (resource.getPath().endsWith(".js") && resource.getPath().length() > 3) { //$NON-NLS-1$
					if (!resource.exists()){
						// The requested javascript file doesn't exist.  See if we can satisfy the request
						// by converting a .jsx file.

						// Construct a resource object for the .jsx file with the same base name
						// and in the same directory as the requested javascript file.
						String path = resource.getReferenceURI().getPath();
						int idx = path.lastIndexOf("/"); //$NON-NLS-1$
						String name = path.substring(idx == -1 ? 0 : idx+1, path.length()-3) + ".jsx"; //$NON-NLS-1$
						IResource jsxRes = aggregator.newResource(resource.resolve(name));
						if (jsxRes.exists()) {
							ICache cache = aggregator.getCacheManager().getCache();
							try {
								IResourceConverterCache jsxCache = (IResourceConverterCache)cache.getCache(JSX_CACHE_NAME);
								if (jsxCache == null) {
									throw new NotFoundException(JSX_CACHE_NAME);
								}
								// Use the resource's reference uri as the cache key
								String cacheKey = resource.getReferenceURI().toString();
								// get the converted resource from the cache.
								jsxRes.setReferenceURI(resource.getReferenceURI());
								result = jsxCache.convert(cacheKey, jsxRes);
							} catch (IOException ex) {
								log.logp(Level.WARNING, sourceClass, sourceMethod, ex.getMessage(), ex);
								result = new ExceptionResource(resource.getReferenceURI(), resource.lastModified(), ex);
							}
						}
					}
				}
			} else {
				// It's a folder resource.  Wrap the folder resource so that we can override the
				// tree walker so as to make .jsx files in folder listings appear as .js files.
				return new FolderResourceWrapper(resource);
			}
		}
		if (isTraceLogging) {
			log.exiting(sourceClass, sourceMethod, result);
		}
		return result;
	}
1251005
private void mapToBean(Map<?, ?> map, Object bean) {
		valueProviderToBean(new MapValueProvider(map, this.copyOptions.ignoreCase), bean);
	}
445638
public static Map mapValues(Mapper mapper, Map map) {
        return mapValues(mapper, map, false);
    }
1023309
public static byte[] readByteArrayFromResource(String resource) throws IOException {
        InputStream in = getResourceAsStream(resource);
        if (in == null) {
            return null;
        }

        try {
            return readByteArray(in);
        } finally {
            closeQuietly(in);
        }
    }
665125
public static String getResourceURL(String resource) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        return cl.getResource(resource).toString();
    }
272973
public static String getValue(Map<String,String> map, String key, String defaultValue) {
		return map.containsKey( key ) ? map.get( key ) : defaultValue;
	}