public class ResourceKeyUtils
extends java.lang.Object
Constructor and Description |
---|
ResourceKeyUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
convertFactoryParametersToString(java.util.Map factoryParameters)
Returns the list of factory parameters for the specified ResourceKey as a String
representation in the format:
|
static java.lang.String |
createStringResourceKey(java.lang.String schema,
java.lang.String identifier,
java.util.Map factoryParameters)
Returns a string representation of the ResourceKey based on the pieces that are passed as parameters
|
static ResourceKey |
embedResourceInKey(ResourceManager manager,
ResourceKey source,
java.util.Map factoryParameters)
Returns a new ResourceKey with the specified source resource embedded inside as a byte []
|
static ResourceKeyData |
parse(java.lang.String resourceKeyString)
Parses the string version of the Resource Key into the components
|
static java.util.Map |
parseFactoryParametersFromString(java.lang.String factoryParameters)
Returns a Map of parameters based on the input string.
|
static java.lang.Object |
readSchemaFromString(java.lang.String data)
Returns the schema portion of the serialized ResourceKey string.
|
static ResourceKey |
toResourceKey(java.lang.Object value,
ResourceManager resourceManager,
ResourceKey contextKey,
java.util.Map parameters)
Performs a simple attempt at a "smart" conversion to a ResourceKey.
|
public static java.lang.String createStringResourceKey(java.lang.String schema, java.lang.String identifier, java.util.Map factoryParameters)
schema
- the string representation of the schemaidentifier
- the string representation of the identifierfactoryParameters
- the set of factory parameters (null
allowed)public static ResourceKeyData parse(java.lang.String resourceKeyString) throws ResourceKeyCreationException
ResourceKeyCreationException
public static java.lang.String convertFactoryParametersToString(java.util.Map factoryParameters)
key=value:key=value:...:key=valueThe colon (:) is the separator between parameters and the equal sign (=) is the separator between the key and the value. If the factory parameters is empty,
null
will be returnedfactoryParameters
- the parameter map.public static java.util.Map parseFactoryParametersFromString(java.lang.String factoryParameters)
getFactoryParametersAsString()
method.factoryParameters
- the String representation of factory parametersnull
if the source string was null or contained no datapublic static java.lang.Object readSchemaFromString(java.lang.String data)
null
will be returned.data
- the String serialized version of a ResourceKey
public static ResourceKey toResourceKey(java.lang.Object value, ResourceManager resourceManager, ResourceKey contextKey, java.util.Map parameters) throws ResourceKeyCreationException
value
is null
, this method will return null
value
is a ResourceKey
, the value
will be returnedvalue
is a String
and is syntactically valid as a URL
,
it will be converted to a URL
and then used to create a ResourceKey
value
is a String
and is NOT syntactically valid as a URL
,
it will be converted ot a File
and then used to create a ResourceKey
value
- the object to convert to a ResourceKey
resourceManager
- the resource manager used in key creationparameters
- the parameters that should be passed to generate a resource keyResourceKeyCreationException
- indicates the value can not be used to create a Resource Keypublic static ResourceKey embedResourceInKey(ResourceManager manager, ResourceKey source, java.util.Map factoryParameters) throws java.io.IOException, ResourceKeyCreationException, ResourceLoadingException
source
- the ResourceKey to the source which will be embedded - NOTE: the pattern can specify an exact name
or a pattern for creating a temporary name. If the name exists, it will be replaced.factoryParameters
- any factory parameters which should be added to the ResourceKey being createdjava.io.IOException
ResourceKeyCreationException
ResourceLoadingException