public class PgeMetadata extends Object
Metadata
sources given to a PGE.
NOTE: 2 ways to update DYNAMIC metadata: 1) Create a key link to a DYNAMIC metadata
key, then change the value of the key link or 2) add metadata then mark the
key as dynamic and commit it.Modifier and Type | Class and Description |
---|---|
static class |
PgeMetadata.Type |
Modifier and Type | Field and Description |
---|---|
static List<PgeMetadata.Type> |
DEFAULT_COMBINE_ORDER |
static List<PgeMetadata.Type> |
DEFAULT_QUERY_ORDER |
Constructor and Description |
---|
PgeMetadata() |
PgeMetadata(Metadata staticMetadata,
Metadata dynamicMetadata) |
PgeMetadata(PgeMetadata pgeMetadata) |
Modifier and Type | Method and Description |
---|---|
Metadata |
asMetadata(PgeMetadata.Type... types)
Combines STATIC, DYNAMIC, and LOCAL metadata into one metadata object.
|
void |
commitMarkedDynamicMetadataKeys(String... keys)
Use to commit marked LOCAL keys to DYNAMIC keys.
|
List<String> |
getAllMetadata(PgeTaskMetKeys key,
PgeMetadata.Type... types) |
List<String> |
getAllMetadata(String key,
PgeMetadata.Type... types)
Get metadata values for given key.
|
protected Set<String> |
getMarkedAsDynamicMetadataKeys() |
String |
getMetadata(PgeTaskMetKeys key,
PgeMetadata.Type... types) |
String |
getMetadata(String key,
PgeMetadata.Type... types)
Returns the first value returned by
getAllMetadata(String, Type...) , if it returns
null then this method will also return null. |
List<String> |
getReferenceKeyPath(String key)
Determines the path by which the given key (if it is a key link) links to
the key whose value it will return.
|
boolean |
isLink(String key)
Check if the given key name is a key link.
|
void |
linkKey(String keyLink,
String key)
Create a key which is a link to another key, such that if you get the
metadata values for the created link it will return the current metadata
values of the key it was linked to.
|
void |
markAsDynamicMetadataKey(String... keys)
Use to mark LOCAL keys which should be moved into DYNAMIC metadata when
commitMarkedDynamicMetadataKeys(String...) is invoked. |
void |
replaceMetadata(Metadata metadata)
Replace all key values with the given key values in the provided
Metadata . |
void |
replaceMetadata(PgeMetadata pgeMetadata)
Replaces or creates this
PgeMetadata 's metadata with given
PgeMetadata 's metadata. |
void |
replaceMetadata(PgeMetadata pgeMetadata,
String group)
Replaces or creates this
PgeMetadata 's metadata with given
PgeMetadata 's metadata. |
void |
replaceMetadata(PgeTaskMetKeys key,
List<String> values) |
void |
replaceMetadata(PgeTaskMetKeys key,
String value) |
void |
replaceMetadata(String key,
List<String> values)
Replace the given key's values with the given values.
|
void |
replaceMetadata(String key,
String value)
Replace the given key's value with the given value.
|
String |
resolveKey(String key)
Find the actual key whose value will be returned for the given key.
|
void |
unlinkKey(String keyLink)
Removes a key link reference.
|
public static final List<PgeMetadata.Type> DEFAULT_COMBINE_ORDER
public static final List<PgeMetadata.Type> DEFAULT_QUERY_ORDER
public PgeMetadata()
public PgeMetadata(PgeMetadata pgeMetadata)
public void replaceMetadata(PgeMetadata pgeMetadata)
PgeMetadata
's metadata with given
PgeMetadata
's metadata. Also adds in the list of given
PgeMetadata
's LOCAL metadata marked for promotion DYNAMIC
metadata and list of key links.pgeMetadata
- A PgeMetadata
whose metadata and key links will be added
to this PgeMetadata
's metadata and key links.public void replaceMetadata(PgeMetadata pgeMetadata, String group)
PgeMetadata
's metadata with given
PgeMetadata
's metadata. The provided "group" will be used to
namespace the given PgeMetadata
's LOCAL metadata when add to this
PgeMetadata
's LOCAL metadata. It will also namespace given
PgeMetadata
's key links before adding then to this
PgeMetadata
's key links. Also add in the list of given
PgeMetadata
's LOCAL metadata marked for promotion DYNAMIC
metadata.pgeMetadata
- A PgeMetadata
whose metadata and key links will be added
to this PgeMetadata
's metadata and key links.group
- The namespace which will be used to namespace given
PgeMetadata
's LOCAL metadata and key links before being
added to this PgeMetadata
's LOCAL metadata and key
links.public void markAsDynamicMetadataKey(String... keys)
commitMarkedDynamicMetadataKeys(String...)
is invoked. If no
args are specified then all LOCAL metadata is marked for move to
DYNAMIC metadata.keys
- Keys to mark as to be made DYNAMIC, otherwise if no keys then
all LOCAL metadata keys are mark for move to DYNAMIC.public void commitMarkedDynamicMetadataKeys(String... keys)
keys
- The list of marked LOCAL metadata keys which should be moved
into DYNAMIC metadata. If no keys are specified then all marked
keys are moved.public void linkKey(String keyLink, String key)
keyLink
- The name of the link key you wish to create.key
- The key you which to link to (may also be a key link)public void unlinkKey(String keyLink)
keyLink
- The key link which you wish to destroy.public boolean isLink(String key)
key
- The key name in question.public String resolveKey(String key)
key
- The name of a key or key link.public List<String> getReferenceKeyPath(String key)
List
will be of size 1 and will
contain just that key. However, if the given key is a key link which
points to another key link then the returning List
will be greater
than 1 (will depend on how many key links are connected before they actual
point to a key. If the given key is a key, then the returning List
will be empty.key
- The path to the key whose value will be returned for the give
key.List
.public void replaceMetadata(PgeTaskMetKeys key, String value)
public void replaceMetadata(String key, String value)
key
- The key or key link for whose value should be replaced.value
- The value to give the given key. Will replace any existing value
or will be the value of a newly created LOCAL key.public void replaceMetadata(Metadata metadata)
Metadata
. If the key does not exist it will be created.metadata
- Metadata
to replace or create.public void replaceMetadata(PgeTaskMetKeys key, List<String> values)
public void replaceMetadata(String key, List<String> values)
key
- The key or key link for whose values should be replaced.values
- The values to give the given key. Will replace any existing
values or will be the values of a newly created LOCAL key.public Metadata asMetadata(PgeMetadata.Type... types)
types
- The Type hierarchy you which to use when metadata is combined,
if no args then DEFAULT_COMBINE_ORDER is used.public List<String> getAllMetadata(PgeTaskMetKeys key, PgeMetadata.Type... types)
public List<String> getAllMetadata(String key, PgeMetadata.Type... types)
key
- The key for whose metadata values should be returned.types
- The type hierarchy which should be used, if no Types specified
DEFAULT_QUERY_ORDER will be used.public String getMetadata(PgeTaskMetKeys key, PgeMetadata.Type... types)
public String getMetadata(String key, PgeMetadata.Type... types)
getAllMetadata(String, Type...)
, if it returns
null then this method will also return null.Copyright © 1999–2017 Apache OODT. All rights reserved.