public class LocalEnvironment extends Object
Punchlets may need to load resource files. Some of them are big like the GeoIp databases, or Json files. These are installed on storm servers, or made available through http. In both case they are loaded by the punchlets once compiled in the worker, i.e. on remote servers.
Resources files are searched in order from the PUNCHPLATFORM_CONF_DIR directory (not likely there is one), next from a PUNCHPLATFORM_RESOURCES_DIR directory.
If none are defined you are likely to run in a Storm cluster. Bolts add the STORM_DIR/external/punchplatform/resources directory in the path.
This class provides the interface to set additional path to search for installed resources.
Modifier and Type | Method and Description |
---|---|
static String |
getCharset() |
static URL |
getPunchPlatformResourcesUrl()
Lookup for a path, relative to one of the resources directory.
|
static URL |
getPunchPlatformResourcesUrl(String resourcePath)
Lookup for a path, relative to one of the resources directory.
|
static void |
setCharset(Map<?,?> map)
Set the charset to be used in the scope of this process.
|
static void |
setCharset(String charset)
Set the charset to be used in the scope of this process.
|
static void |
setPunchPlatformResourcesUrl(String path)
Add a resource directory.
|
static void |
setPunchPlatformResourcesUrl(URL url)
Test method only.
|
public static void setPunchPlatformResourcesUrl(String path)
path
- the path where to find the top level resource directory.public static void setPunchPlatformResourcesUrl(URL url)
url
- the resource url.public static URL getPunchPlatformResourcesUrl()
public static URL getPunchPlatformResourcesUrl(String resourcePath)
resourcePath
- the path you look forpublic static void setCharset(Map<?,?> map)
map
- a configuration map with a possible "punchplatform.charset" property.public static void setCharset(String charset)
charset
- the charsetpublic static String getCharset()
Copyright © 2014–2023. All rights reserved.