The metadata transformation facility allows domain and bucket administrators to define rules to add or replace metadata on incoming objects. These rules are stored in XFORM documents.
As a write operation (PUT, POST, or COPY) passes through the Gateway, rules in the xform sub-resource for a domain and/or bucket are applied and the object's headers are modified accordingly. Metadata rules specify a given header is added to the message if it does not exist or is replaced if it does exist in the request. Headers defined in the domain XFORM take precedence over anything defined in a bucket XFORM.
Metadata Values
Metadata values are specified as strings, with a small number of variables available for substitution, using a ${varname} format where "varname" is the name of the variable.
Specify as a header value ${user}'s stuff on the user rooster's bucket and objects written into that bucket end up with a header value of rooster's stuff.
Metadata Substitution Variables
Variable Name | Description |
---|---|
date:format | Create/update time stamp where format is defined by Java SimpleDateFormat specification |
user | Authenticated user ID |
domain | Domain name |
bucket | Bucket name |
XFORM Document Format
required Root := dict ( optional "metadata" := MetadataXforms optional "comments" := any object type ) MetadataXforms := dict ( HttpHeaderName,HttpHeaderValue ) HttpHeaderName := str # Conforms to HTTP spec HttpHeaderValue := str # Conforms to HTTP spec, plus variables
Example XFORM Document
{ "comments": "Metadata transform document", "metadata": { "X-Written-When-Meta": "${date:yyyyMMdd-HHmmss}", "X-Contains-Meta": "${domain}/${bucket}", "X-Copyright-Meta": "Copyright ${date:yyyy}, MetaCorp, Inc", "X-Author-Meta": "${user}" } }