| 1 | // ================================================================================================= |
| 2 | // ADOBE SYSTEMS INCORPORATED |
| 3 | // Copyright 2006 Adobe Systems Incorporated |
| 4 | // All Rights Reserved |
| 5 | // |
| 6 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms |
| 7 | // of the Adobe license agreement accompanying it. |
| 8 | // ================================================================================================= |
| 9 | |
| 10 | package com.adobe.internal.xmp; |
| 11 | |
| 12 | import java.util.Calendar; |
| 13 | |
| 14 | import com.adobe.internal.xmp.options.IteratorOptions; |
| 15 | import com.adobe.internal.xmp.options.ParseOptions; |
| 16 | import com.adobe.internal.xmp.options.PropertyOptions; |
| 17 | import com.adobe.internal.xmp.properties.XMPProperty; |
| 18 | |
| 19 | |
| 20 | /** |
| 21 | * This class represents the set of XMP metadata as a DOM representation. It has methods to read and |
| 22 | * modify all kinds of properties, create an iterator over all properties and serialize the metadata |
| 23 | * to a String, byte-array or <code>OutputStream</code>. |
| 24 | * |
| 25 | * @author Stefan Makswit |
| 26 | * @version $Revision$ |
| 27 | * @since 20.01.2006 |
| 28 | */ |
| 29 | public interface XMPMeta extends Cloneable |
| 30 | { |
| 31 | // --------------------------------------------------------------------------------------------- |
| 32 | // Basic property manipulation functions |
| 33 | |
| 34 | /** |
| 35 | * The property value getter-methods all take a property specification: the first two parameters |
| 36 | * are always the top level namespace URI (the "schema" namespace) and the basic name |
| 37 | * of the property being referenced. See the introductory discussion of path expression usage |
| 38 | * for more information. |
| 39 | * <p> |
| 40 | * All of the functions return an object inherited from <code>PropertyBase</code> or |
| 41 | * <code>null</code> if the property does not exists. The result object contains the value of |
| 42 | * the property and option flags describing the property. Arrays and the non-leaf levels of |
| 43 | * nodes do not have values. |
| 44 | * <p> |
| 45 | * See {@link PropertyOptions} for detailed information about the options. |
| 46 | * <p> |
| 47 | * This is the simplest property getter, mainly for top level simple properties or after using |
| 48 | * the path composition functions in XMPPathFactory. |
| 49 | * |
| 50 | * @param schemaNS The namespace URI for the property. May be <code>null</code> or the empty |
| 51 | * string if the first component of the propName path contains a namespace prefix. The |
| 52 | * URI must be for a registered namespace. |
| 53 | * @param propName The name of the property. May be a general path expression, must not be |
| 54 | * <code>null</code> or the empty string. Using a namespace prefix on the first |
| 55 | * component is optional. If present without a schemaNS value then the prefix specifies |
| 56 | * the namespace. The prefix must be for a registered namespace. If both a schemaNS URI |
| 57 | * and propName prefix are present, they must be corresponding parts of a registered |
| 58 | * namespace. |
| 59 | * @return Returns a <code>XMPProperty</code> containing the value and the options or |
| 60 | * <code>null</code> if the property does not exist. |
| 61 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 62 | */ |
| 63 | XMPProperty getProperty(String schemaNS, String propName) throws XMPException; |
| 64 | |
| 65 | |
| 66 | /** |
| 67 | * Provides access to items within an array. The index is passed as an integer, you need not |
| 68 | * worry about the path string syntax for array items, convert a loop index to a string, etc. |
| 69 | * |
| 70 | * @param schemaNS The namespace URI for the array. Has the same usage as in getProperty. |
| 71 | * @param arrayName The name of the array. May be a general path expression, must not be |
| 72 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 73 | * propName in <code>getProperty()</code>. |
| 74 | * @param itemIndex The index of the desired item. Arrays in XMP are indexed from 1. The |
| 75 | * constant {@link XMPConst#ARRAY_LAST_ITEM} always refers to the last existing array |
| 76 | * item. |
| 77 | * @return Returns a <code>XMPProperty</code> containing the value and the options or |
| 78 | * <code>null</code> if the property does not exist. |
| 79 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 80 | */ |
| 81 | XMPProperty getArrayItem(String schemaNS, String arrayName, int itemIndex) throws XMPException; |
| 82 | |
| 83 | |
| 84 | /** |
| 85 | * Returns the number of items in the array. |
| 86 | * |
| 87 | * @param schemaNS The namespace URI for the array. Has the same usage as in getProperty. |
| 88 | * @param arrayName The name of the array. May be a general path expression, must not be |
| 89 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 90 | * propName in <code>getProperty()</code>. |
| 91 | * @return Returns the number of items in the array. |
| 92 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 93 | */ |
| 94 | int countArrayItems(String schemaNS, String arrayName) throws XMPException; |
| 95 | |
| 96 | |
| 97 | /** |
| 98 | * Provides access to fields within a nested structure. The namespace for the field is passed as |
| 99 | * a URI, you need not worry about the path string syntax. |
| 100 | * <p> |
| 101 | * The names of fields should be XML qualified names, that is within an XML namespace. The path |
| 102 | * syntax for a qualified name uses the namespace prefix. This is unreliable since the prefix is |
| 103 | * never guaranteed. The URI is the formal name, the prefix is just a local shorthand in a given |
| 104 | * sequence of XML text. |
| 105 | * |
| 106 | * @param schemaNS The namespace URI for the struct. Has the same usage as in getProperty. |
| 107 | * @param structName The name of the struct. May be a general path expression, must not be |
| 108 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 109 | * propName in <code>getProperty()</code>. |
| 110 | * @param fieldNS The namespace URI for the field. Has the same URI and prefix usage as the |
| 111 | * schemaNS parameter. |
| 112 | * @param fieldName The name of the field. Must be a single XML name, must not be |
| 113 | * <code>null</code> or the empty string. Has the same namespace prefix usage as the |
| 114 | * structName parameter. |
| 115 | * @return Returns a <code>XMPProperty</code> containing the value and the options or |
| 116 | * <code>null</code> if the property does not exist. Arrays and non-leaf levels of |
| 117 | * structs do not have values. |
| 118 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 119 | */ |
| 120 | XMPProperty getStructField( |
| 121 | String schemaNS, |
| 122 | String structName, |
| 123 | String fieldNS, |
| 124 | String fieldName) throws XMPException; |
| 125 | |
| 126 | |
| 127 | /** |
| 128 | * Provides access to a qualifier attached to a property. The namespace for the qualifier is |
| 129 | * passed as a URI, you need not worry about the path string syntax. In many regards qualifiers |
| 130 | * are like struct fields. See the introductory discussion of qualified properties for more |
| 131 | * information. |
| 132 | * <p> |
| 133 | * The names of qualifiers should be XML qualified names, that is within an XML namespace. The |
| 134 | * path syntax for a qualified name uses the namespace prefix. This is unreliable since the |
| 135 | * prefix is never guaranteed. The URI is the formal name, the prefix is just a local shorthand |
| 136 | * in a given sequence of XML text. |
| 137 | * <p> |
| 138 | * <em>Note:</em> Qualifiers are only supported for simple leaf properties at this time. |
| 139 | * |
| 140 | * @param schemaNS The namespace URI for the struct. Has the same usage as in getProperty. |
| 141 | * @param propName The name of the property to which the qualifier is attached. May be a general |
| 142 | * path expression, must not be <code>null</code> or the empty string. Has the same |
| 143 | * namespace prefix usage as in <code>getProperty()</code>. |
| 144 | * @param qualNS The namespace URI for the qualifier. Has the same URI and prefix usage as the |
| 145 | * schemaNS parameter. |
| 146 | * @param qualName The name of the qualifier. Must be a single XML name, must not be |
| 147 | * <code>null</code> or the empty string. Has the same namespace prefix usage as the |
| 148 | * propName parameter. |
| 149 | * @return Returns a <code>XMPProperty</code> containing the value and the options of the |
| 150 | * qualifier or <code>null</code> if the property does not exist. The name of the |
| 151 | * qualifier must be a single XML name, must not be <code>null</code> or the empty |
| 152 | * string. Has the same namespace prefix usage as the propName parameter. |
| 153 | * <p> |
| 154 | * The value of the qualifier is only set if it has one (Arrays and non-leaf levels of |
| 155 | * structs do not have values). |
| 156 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 157 | */ |
| 158 | XMPProperty getQualifier( |
| 159 | String schemaNS, |
| 160 | String propName, |
| 161 | String qualNS, |
| 162 | String qualName) throws XMPException; |
| 163 | |
| 164 | |
| 165 | |
| 166 | // --------------------------------------------------------------------------------------------- |
| 167 | // Functions for setting property values |
| 168 | |
| 169 | /** |
| 170 | * The property value <code>setters</code> all take a property specification, their |
| 171 | * differences are in the form of this. The first two parameters are always the top level |
| 172 | * namespace URI (the <code>schema</code> namespace) and the basic name of the property being |
| 173 | * referenced. See the introductory discussion of path expression usage for more information. |
| 174 | * <p> |
| 175 | * All of the functions take a string value for the property and option flags describing the |
| 176 | * property. The value must be Unicode in UTF-8 encoding. Arrays and non-leaf levels of structs |
| 177 | * do not have values. Empty arrays and structs may be created using appropriate option flags. |
| 178 | * All levels of structs that is assigned implicitly are created if necessary. appendArayItem |
| 179 | * implicitly creates the named array if necessary. |
| 180 | * <p> |
| 181 | * See {@link PropertyOptions} for detailed information about the options. |
| 182 | * <p> |
| 183 | * This is the simplest property setter, mainly for top level simple properties or after using |
| 184 | * the path composition functions in {@link XMPPathFactory}. |
| 185 | * |
| 186 | * @param schemaNS The namespace URI for the property. Has the same usage as in getProperty. |
| 187 | * @param propName The name of the property. |
| 188 | * Has the same usage as in <code>getProperty()</code>. |
| 189 | * @param propValue the value for the property (only leaf properties have a value). |
| 190 | * Arrays and non-leaf levels of structs do not have values. |
| 191 | * Must be <code>null</code> if the value is not relevant. |
| 192 | * The value is automatically detected: Boolean, Integer, Long, Double, XMPDateTime and |
| 193 | * byte[] are handled, on all other <code>toString()</code> is called. |
| 194 | * |
| 195 | * @param options Option flags describing the property. See the earlier description. |
| 196 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 197 | */ |
| 198 | void setProperty( |
| 199 | String schemaNS, |
| 200 | String propName, |
| 201 | Object propValue, |
| 202 | PropertyOptions options) throws XMPException; |
| 203 | |
| 204 | |
| 205 | /** |
| 206 | * @see XMPMeta#setProperty(String, String, Object, PropertyOptions) |
| 207 | * |
| 208 | * @param schemaNS The namespace URI |
| 209 | * @param propName The name of the property |
| 210 | * @param propValue the value for the property |
| 211 | * @throws XMPException Wraps all errors and exceptions |
| 212 | */ |
| 213 | void setProperty( |
| 214 | String schemaNS, |
| 215 | String propName, |
| 216 | Object propValue) throws XMPException; |
| 217 | |
| 218 | |
| 219 | /** |
| 220 | * Replaces an item within an array. The index is passed as an integer, you need not worry about |
| 221 | * the path string syntax for array items, convert a loop index to a string, etc. The array |
| 222 | * passed must already exist. In normal usage the selected array item is modified. A new item is |
| 223 | * automatically appended if the index is the array size plus 1. |
| 224 | * |
| 225 | * @param schemaNS The namespace URI for the array. Has the same usage as in getProperty. |
| 226 | * @param arrayName The name of the array. May be a general path expression, must not be |
| 227 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 228 | * propName in getProperty. |
| 229 | * @param itemIndex The index of the desired item. Arrays in XMP are indexed from 1. To address |
| 230 | * the last existing item, use {@link XMPMeta#countArrayItems(String, String)} to find |
| 231 | * out the length of the array. |
| 232 | * @param itemValue the new value of the array item. Has the same usage as propValue in |
| 233 | * <code>setProperty()</code>. |
| 234 | * @param options the set options for the item. |
| 235 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 236 | */ |
| 237 | void setArrayItem( |
| 238 | String schemaNS, |
| 239 | String arrayName, |
| 240 | int itemIndex, |
| 241 | String itemValue, |
| 242 | PropertyOptions options) throws XMPException; |
| 243 | |
| 244 | |
| 245 | /** |
| 246 | * @see XMPMeta#setArrayItem(String, String, int, String, PropertyOptions) |
| 247 | * |
| 248 | * @param schemaNS The namespace URI |
| 249 | * @param arrayName The name of the array |
| 250 | * @param itemIndex The index to insert the new item |
| 251 | * @param itemValue the new value of the array item |
| 252 | * @throws XMPException Wraps all errors and exceptions |
| 253 | */ |
| 254 | void setArrayItem( |
| 255 | String schemaNS, |
| 256 | String arrayName, |
| 257 | int itemIndex, |
| 258 | String itemValue) throws XMPException; |
| 259 | |
| 260 | |
| 261 | /** |
| 262 | * Inserts an item into an array previous to the given index. The index is passed as an integer, |
| 263 | * you need not worry about the path string syntax for array items, convert a loop index to a |
| 264 | * string, etc. The array passed must already exist. In normal usage the selected array item is |
| 265 | * modified. A new item is automatically appended if the index is the array size plus 1. |
| 266 | * |
| 267 | * @param schemaNS The namespace URI for the array. Has the same usage as in getProperty. |
| 268 | * @param arrayName The name of the array. May be a general path expression, must not be |
| 269 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 270 | * propName in getProperty. |
| 271 | * @param itemIndex The index to insert the new item. Arrays in XMP are indexed from 1. Use |
| 272 | * <code>XMPConst.ARRAY_LAST_ITEM</code> to append items. |
| 273 | * @param itemValue the new value of the array item. Has the same usage as |
| 274 | * propValue in <code>setProperty()</code>. |
| 275 | * @param options the set options that decide about the kind of the node. |
| 276 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 277 | */ |
| 278 | void insertArrayItem( |
| 279 | String schemaNS, |
| 280 | String arrayName, |
| 281 | int itemIndex, |
| 282 | String itemValue, |
| 283 | PropertyOptions options) throws XMPException; |
| 284 | |
| 285 | |
| 286 | /** |
| 287 | * @see XMPMeta#insertArrayItem(String, String, int, String, PropertyOptions) |
| 288 | * |
| 289 | * @param schemaNS The namespace URI for the array |
| 290 | * @param arrayName The name of the array |
| 291 | * @param itemIndex The index to insert the new item |
| 292 | * @param itemValue the value of the array item |
| 293 | * @throws XMPException Wraps all errors and exceptions |
| 294 | */ |
| 295 | void insertArrayItem( |
| 296 | String schemaNS, |
| 297 | String arrayName, |
| 298 | int itemIndex, |
| 299 | String itemValue) throws XMPException; |
| 300 | |
| 301 | |
| 302 | /** |
| 303 | * Simplifies the construction of an array by not requiring that you pre-create an empty array. |
| 304 | * The array that is assigned is created automatically if it does not yet exist. Each call to |
| 305 | * appendArrayItem() appends an item to the array. The corresponding parameters have the same |
| 306 | * use as setArrayItem(). The arrayOptions parameter is used to specify what kind of array. If |
| 307 | * the array exists, it must have the specified form. |
| 308 | * |
| 309 | * @param schemaNS The namespace URI for the array. Has the same usage as in getProperty. |
| 310 | * @param arrayName The name of the array. May be a general path expression, must not be null or |
| 311 | * the empty string. Has the same namespace prefix usage as propPath in getProperty. |
| 312 | * @param arrayOptions Option flags describing the array form. The only valid options are |
| 313 | * <ul> |
| 314 | * <li> {@link PropertyOptions#ARRAY}, |
| 315 | * <li> {@link PropertyOptions#ARRAY_ORDERED}, |
| 316 | * <li> {@link PropertyOptions#ARRAY_ALTERNATE} or |
| 317 | * <li> {@link PropertyOptions#ARRAY_ALT_TEXT}. |
| 318 | * </ul> |
| 319 | * <em>Note:</em> the array options only need to be provided if the array is not |
| 320 | * already existing, otherwise you can set them to <code>null</code> or use |
| 321 | * {@link XMPMeta#appendArrayItem(String, String, String)}. |
| 322 | * @param itemValue the value of the array item. Has the same usage as propValue in getProperty. |
| 323 | * @param itemOptions Option flags describing the item to append ({@link PropertyOptions}) |
| 324 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 325 | */ |
| 326 | void appendArrayItem( |
| 327 | String schemaNS, |
| 328 | String arrayName, |
| 329 | PropertyOptions arrayOptions, |
| 330 | String itemValue, |
| 331 | PropertyOptions itemOptions) throws XMPException; |
| 332 | |
| 333 | |
| 334 | /** |
| 335 | * @see XMPMeta#appendArrayItem(String, String, PropertyOptions, String, PropertyOptions) |
| 336 | * |
| 337 | * @param schemaNS The namespace URI for the array |
| 338 | * @param arrayName The name of the array |
| 339 | * @param itemValue the value of the array item |
| 340 | * @throws XMPException Wraps all errors and exceptions |
| 341 | */ |
| 342 | void appendArrayItem( |
| 343 | String schemaNS, |
| 344 | String arrayName, |
| 345 | String itemValue) throws XMPException; |
| 346 | |
| 347 | |
| 348 | /** |
| 349 | * Provides access to fields within a nested structure. The namespace for the field is passed as |
| 350 | * a URI, you need not worry about the path string syntax. The names of fields should be XML |
| 351 | * qualified names, that is within an XML namespace. The path syntax for a qualified name uses |
| 352 | * the namespace prefix, which is unreliable because the prefix is never guaranteed. The URI is |
| 353 | * the formal name, the prefix is just a local shorthand in a given sequence of XML text. |
| 354 | * |
| 355 | * @param schemaNS The namespace URI for the struct. Has the same usage as in getProperty. |
| 356 | * @param structName The name of the struct. May be a general path expression, must not be null |
| 357 | * or the empty string. Has the same namespace prefix usage as propName in getProperty. |
| 358 | * @param fieldNS The namespace URI for the field. Has the same URI and prefix usage as the |
| 359 | * schemaNS parameter. |
| 360 | * @param fieldName The name of the field. Must be a single XML name, must not be null or the |
| 361 | * empty string. Has the same namespace prefix usage as the structName parameter. |
| 362 | * @param fieldValue the value of thefield, if the field has a value. |
| 363 | * Has the same usage as propValue in getProperty. |
| 364 | * @param options Option flags describing the field. See the earlier description. |
| 365 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 366 | */ |
| 367 | void setStructField( |
| 368 | String schemaNS, |
| 369 | String structName, |
| 370 | String fieldNS, |
| 371 | String fieldName, |
| 372 | String fieldValue, |
| 373 | PropertyOptions options) throws XMPException; |
| 374 | |
| 375 | |
| 376 | /** |
| 377 | * @see XMPMeta#setStructField(String, String, String, String, String, PropertyOptions) |
| 378 | * |
| 379 | * @param schemaNS The namespace URI for the struct |
| 380 | * @param structName The name of the struct |
| 381 | * @param fieldNS The namespace URI for the field |
| 382 | * @param fieldName The name of the field |
| 383 | * @param fieldValue the value of the field |
| 384 | * @throws XMPException Wraps all errors and exceptions |
| 385 | */ |
| 386 | void setStructField( |
| 387 | String schemaNS, |
| 388 | String structName, |
| 389 | String fieldNS, |
| 390 | String fieldName, |
| 391 | String fieldValue) throws XMPException; |
| 392 | |
| 393 | |
| 394 | /** |
| 395 | * Provides access to a qualifier attached to a property. The namespace for the qualifier is |
| 396 | * passed as a URI, you need not worry about the path string syntax. In many regards qualifiers |
| 397 | * are like struct fields. See the introductory discussion of qualified properties for more |
| 398 | * information. The names of qualifiers should be XML qualified names, that is within an XML |
| 399 | * namespace. The path syntax for a qualified name uses the namespace prefix, which is |
| 400 | * unreliable because the prefix is never guaranteed. The URI is the formal name, the prefix is |
| 401 | * just a local shorthand in a given sequence of XML text. The property the qualifier |
| 402 | * will be attached has to exist. |
| 403 | * |
| 404 | * @param schemaNS The namespace URI for the struct. Has the same usage as in getProperty. |
| 405 | * @param propName The name of the property to which the qualifier is attached. Has the same |
| 406 | * usage as in getProperty. |
| 407 | * @param qualNS The namespace URI for the qualifier. Has the same URI and prefix usage as the |
| 408 | * schemaNS parameter. |
| 409 | * @param qualName The name of the qualifier. Must be a single XML name, must not be |
| 410 | * <code>null</code> or the empty string. Has the same namespace prefix usage as the |
| 411 | * propName parameter. |
| 412 | * @param qualValue A pointer to the <code>null</code> terminated UTF-8 string that is the |
| 413 | * value of the qualifier, if the qualifier has a value. Has the same usage as propValue |
| 414 | * in getProperty. |
| 415 | * @param options Option flags describing the qualifier. See the earlier description. |
| 416 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 417 | */ |
| 418 | void setQualifier( |
| 419 | String schemaNS, |
| 420 | String propName, |
| 421 | String qualNS, |
| 422 | String qualName, |
| 423 | String qualValue, |
| 424 | PropertyOptions options) throws XMPException; |
| 425 | |
| 426 | |
| 427 | /** |
| 428 | * @see XMPMeta#setQualifier(String, String, String, String, String, PropertyOptions) |
| 429 | * |
| 430 | * @param schemaNS The namespace URI for the struct |
| 431 | * @param propName The name of the property to which the qualifier is attached |
| 432 | * @param qualNS The namespace URI for the qualifier |
| 433 | * @param qualName The name of the qualifier |
| 434 | * @param qualValue the value of the qualifier |
| 435 | * @throws XMPException Wraps all errors and exceptions |
| 436 | */ |
| 437 | void setQualifier( |
| 438 | String schemaNS, |
| 439 | String propName, |
| 440 | String qualNS, |
| 441 | String qualName, |
| 442 | String qualValue) throws XMPException; |
| 443 | |
| 444 | |
| 445 | |
| 446 | // --------------------------------------------------------------------------------------------- |
| 447 | // Functions for deleting and detecting properties. These should be obvious from the |
| 448 | // descriptions of the getters and setters. |
| 449 | |
| 450 | /** |
| 451 | * Deletes the given XMP subtree rooted at the given property. It is not an error if the |
| 452 | * property does not exist. |
| 453 | * |
| 454 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 455 | * <code>getProperty()</code>. |
| 456 | * @param propName The name of the property. Has the same usage as in getProperty. |
| 457 | */ |
| 458 | void deleteProperty(String schemaNS, String propName); |
| 459 | |
| 460 | |
| 461 | /** |
| 462 | * Deletes the given XMP subtree rooted at the given array item. It is not an error if the array |
| 463 | * item does not exist. |
| 464 | * |
| 465 | * @param schemaNS The namespace URI for the array. Has the same usage as in getProperty. |
| 466 | * @param arrayName The name of the array. May be a general path expression, must not be |
| 467 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 468 | * propName in <code>getProperty()</code>. |
| 469 | * @param itemIndex The index of the desired item. Arrays in XMP are indexed from 1. The |
| 470 | * constant <code>XMPConst.ARRAY_LAST_ITEM</code> always refers to the last |
| 471 | * existing array item. |
| 472 | */ |
| 473 | void deleteArrayItem(String schemaNS, String arrayName, int itemIndex); |
| 474 | |
| 475 | |
| 476 | /** |
| 477 | * Deletes the given XMP subtree rooted at the given struct field. It is not an error if the |
| 478 | * field does not exist. |
| 479 | * |
| 480 | * @param schemaNS The namespace URI for the struct. Has the same usage as in |
| 481 | * <code>getProperty()</code>. |
| 482 | * @param structName The name of the struct. May be a general path expression, must not be |
| 483 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 484 | * propName in getProperty. |
| 485 | * @param fieldNS The namespace URI for the field. Has the same URI and prefix usage as the |
| 486 | * schemaNS parameter. |
| 487 | * @param fieldName The name of the field. Must be a single XML name, must not be |
| 488 | * <code>null</code> or the empty string. Has the same namespace prefix usage as the |
| 489 | * structName parameter. |
| 490 | */ |
| 491 | void deleteStructField(String schemaNS, String structName, String fieldNS, String fieldName); |
| 492 | |
| 493 | |
| 494 | /** |
| 495 | * Deletes the given XMP subtree rooted at the given qualifier. It is not an error if the |
| 496 | * qualifier does not exist. |
| 497 | * |
| 498 | * @param schemaNS The namespace URI for the struct. Has the same usage as in |
| 499 | * <code>getProperty()</code>. |
| 500 | * @param propName The name of the property to which the qualifier is attached. Has the same |
| 501 | * usage as in getProperty. |
| 502 | * @param qualNS The namespace URI for the qualifier. Has the same URI and prefix usage as the |
| 503 | * schemaNS parameter. |
| 504 | * @param qualName The name of the qualifier. Must be a single XML name, must not be |
| 505 | * <code>null</code> or the empty string. Has the same namespace prefix usage as the |
| 506 | * propName parameter. |
| 507 | */ |
| 508 | void deleteQualifier(String schemaNS, String propName, String qualNS, String qualName); |
| 509 | |
| 510 | |
| 511 | /** |
| 512 | * Returns whether the property exists. |
| 513 | * |
| 514 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 515 | * <code>getProperty()</code>. |
| 516 | * @param propName The name of the property. |
| 517 | * Has the same usage as in <code>getProperty()</code>. |
| 518 | * @return Returns true if the property exists. |
| 519 | */ |
| 520 | boolean doesPropertyExist(String schemaNS, String propName); |
| 521 | |
| 522 | |
| 523 | /** |
| 524 | * Tells if the array item exists. |
| 525 | * |
| 526 | * @param schemaNS The namespace URI for the array. Has the same usage as in |
| 527 | * <code>getProperty()</code>. |
| 528 | * @param arrayName The name of the array. May be a general path expression, must not be |
| 529 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 530 | * propName in <code>getProperty()</code>. |
| 531 | * @param itemIndex The index of the desired item. Arrays in XMP are indexed from 1. The |
| 532 | * constant <code>XMPConst.ARRAY_LAST_ITEM</code> always refers to the last |
| 533 | * existing array item. |
| 534 | * @return Returns <code>true</code> if the array exists, <code>false</code> otherwise. |
| 535 | */ |
| 536 | boolean doesArrayItemExist(String schemaNS, String arrayName, int itemIndex); |
| 537 | |
| 538 | |
| 539 | /** |
| 540 | * DoesStructFieldExist tells if the struct field exists. |
| 541 | * |
| 542 | * @param schemaNS The namespace URI for the struct. Has the same usage as in |
| 543 | * <code>getProperty()</code>. |
| 544 | * @param structName The name of the struct. May be a general path expression, must not be |
| 545 | * <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 546 | * propName in <code>getProperty()</code>. |
| 547 | * @param fieldNS The namespace URI for the field. Has the same URI and prefix usage as the |
| 548 | * schemaNS parameter. |
| 549 | * @param fieldName The name of the field. Must be a single XML name, must not be |
| 550 | * <code>null</code> or the empty string. Has the same namespace prefix usage as the |
| 551 | * structName parameter. |
| 552 | * @return Returns true if the field exists. |
| 553 | */ |
| 554 | boolean doesStructFieldExist( |
| 555 | String schemaNS, |
| 556 | String structName, |
| 557 | String fieldNS, |
| 558 | String fieldName); |
| 559 | |
| 560 | |
| 561 | /** |
| 562 | * DoesQualifierExist tells if the qualifier exists. |
| 563 | * |
| 564 | * @param schemaNS The namespace URI for the struct. Has the same usage as in |
| 565 | * <code>getProperty()</code>. |
| 566 | * @param propName The name of the property to which the qualifier is attached. Has the same |
| 567 | * usage as in <code>getProperty()</code>. |
| 568 | * @param qualNS The namespace URI for the qualifier. Has the same URI and prefix usage as the |
| 569 | * schemaNS parameter. |
| 570 | * @param qualName The name of the qualifier. Must be a single XML name, must not be |
| 571 | * <code>null</code> or the empty string. Has the same namespace prefix usage as the |
| 572 | * propName parameter. |
| 573 | * @return Returns true if the qualifier exists. |
| 574 | */ |
| 575 | boolean doesQualifierExist(String schemaNS, String propName, String qualNS, String qualName); |
| 576 | |
| 577 | |
| 578 | // --------------------------------------------------------------------------------------------- |
| 579 | // Specialized Get and Set functions |
| 580 | |
| 581 | /** |
| 582 | * These functions provide convenient support for localized text properties, including a number |
| 583 | * of special and obscure aspects. Localized text properties are stored in alt-text arrays. They |
| 584 | * allow multiple concurrent localizations of a property value, for example a document title or |
| 585 | * copyright in several languages. The most important aspect of these functions is that they |
| 586 | * select an appropriate array item based on one or two RFC 3066 language tags. One of these |
| 587 | * languages, the "specific" language, is preferred and selected if there is an exact match. For |
| 588 | * many languages it is also possible to define a "generic" language that may be used if there |
| 589 | * is no specific language match. The generic language must be a valid RFC 3066 primary subtag, |
| 590 | * or the empty string. For example, a specific language of "en-US" should be used in the US, |
| 591 | * and a specific language of "en-UK" should be used in England. It is also appropriate to use |
| 592 | * "en" as the generic language in each case. If a US document goes to England, the "en-US" |
| 593 | * title is selected by using the "en" generic language and the "en-UK" specific language. It is |
| 594 | * considered poor practice, but allowed, to pass a specific language that is just an RFC 3066 |
| 595 | * primary tag. For example "en" is not a good specific language, it should only be used as a |
| 596 | * generic language. Passing "i" or "x" as the generic language is also considered poor practice |
| 597 | * but allowed. Advice from the W3C about the use of RFC 3066 language tags can be found at: |
| 598 | * http://www.w3.org/International/articles/language-tags/ |
| 599 | * <p> |
| 600 | * <em>Note:</em> RFC 3066 language tags must be treated in a case insensitive manner. The XMP |
| 601 | * Toolkit does this by normalizing their capitalization: |
| 602 | * <ul> |
| 603 | * <li> The primary subtag is lower case, the suggested practice of ISO 639. |
| 604 | * <li> All 2 letter secondary subtags are upper case, the suggested practice of ISO 3166. |
| 605 | * <li> All other subtags are lower case. The XMP specification defines an artificial language, |
| 606 | * <li>"x-default", that is used to explicitly denote a default item in an alt-text array. |
| 607 | * </ul> |
| 608 | * The XMP toolkit normalizes alt-text arrays such that the x-default item is the first item. |
| 609 | * The SetLocalizedText function has several special features related to the x-default item, see |
| 610 | * its description for details. The selection of the array item is the same for GetLocalizedText |
| 611 | * and SetLocalizedText: |
| 612 | * <ul> |
| 613 | * <li> Look for an exact match with the specific language. |
| 614 | * <li> If a generic language is given, look for a partial match. |
| 615 | * <li> Look for an x-default item. |
| 616 | * <li> Choose the first item. |
| 617 | * </ul> |
| 618 | * A partial match with the generic language is where the start of the item's language matches |
| 619 | * the generic string and the next character is '-'. An exact match is also recognized as a |
| 620 | * degenerate case. It is fine to pass x-default as the specific language. In this case, |
| 621 | * selection of an x-default item is an exact match by the first rule, not a selection by the |
| 622 | * 3rd rule. The last 2 rules are fallbacks used when the specific and generic languages fail to |
| 623 | * produce a match. <code>getLocalizedText</code> returns information about a selected item in |
| 624 | * an alt-text array. The array item is selected according to the rules given above. |
| 625 | * |
| 626 | * <em>Note:</em> In a future version of this API a method |
| 627 | * using Java <code>java.lang.Locale</code> will be added. |
| 628 | * |
| 629 | * @param schemaNS The namespace URI for the alt-text array. Has the same usage as in |
| 630 | * <code>getProperty()</code>. |
| 631 | * @param altTextName The name of the alt-text array. May be a general path expression, must not |
| 632 | * be <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 633 | * propName in <code>getProperty()</code>. |
| 634 | * @param genericLang The name of the generic language as an RFC 3066 primary subtag. May be |
| 635 | * <code>null</code> or the empty string if no generic language is wanted. |
| 636 | * @param specificLang The name of the specific language as an RFC 3066 tag. Must not be |
| 637 | * <code>null</code> or the empty string. |
| 638 | * @return Returns an <code>XMPProperty</code> containing the value, the actual language and |
| 639 | * the options if an appropriate alternate collection item exists, <code>null</code> |
| 640 | * if the property. |
| 641 | * does not exist. |
| 642 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 643 | */ |
| 644 | XMPProperty getLocalizedText( |
| 645 | String schemaNS, |
| 646 | String altTextName, |
| 647 | String genericLang, |
| 648 | String specificLang) throws XMPException; |
| 649 | |
| 650 | |
| 651 | /** |
| 652 | * Modifies the value of a selected item in an alt-text array. Creates an appropriate array item |
| 653 | * if necessary, and handles special cases for the x-default item. If the selected item is from |
| 654 | * a match with the specific language, the value of that item is modified. If the existing value |
| 655 | * of that item matches the existing value of the x-default item, the x-default item is also |
| 656 | * modified. If the array only has 1 existing item (which is not x-default), an x-default item |
| 657 | * is added with the given value. If the selected item is from a match with the generic language |
| 658 | * and there are no other generic matches, the value of that item is modified. If the existing |
| 659 | * value of that item matches the existing value of the x-default item, the x-default item is |
| 660 | * also modified. If the array only has 1 existing item (which is not x-default), an x-default |
| 661 | * item is added with the given value. If the selected item is from a partial match with the |
| 662 | * generic language and there are other partial matches, a new item is created for the specific |
| 663 | * language. The x-default item is not modified. If the selected item is from the last 2 rules |
| 664 | * then a new item is created for the specific language. If the array only had an x-default |
| 665 | * item, the x-default item is also modified. If the array was empty, items are created for the |
| 666 | * specific language and x-default. |
| 667 | * |
| 668 | * <em>Note:</em> In a future version of this API a method |
| 669 | * using Java <code>java.lang.Locale</code> will be added. |
| 670 | * |
| 671 | * |
| 672 | * @param schemaNS The namespace URI for the alt-text array. Has the same usage as in |
| 673 | * <code>getProperty()</code>. |
| 674 | * @param altTextName The name of the alt-text array. May be a general path expression, must not |
| 675 | * be <code>null</code> or the empty string. Has the same namespace prefix usage as |
| 676 | * propName in <code>getProperty()</code>. |
| 677 | * @param genericLang The name of the generic language as an RFC 3066 primary subtag. May be |
| 678 | * <code>null</code> or the empty string if no generic language is wanted. |
| 679 | * @param specificLang The name of the specific language as an RFC 3066 tag. Must not be |
| 680 | * <code>null</code> or the empty string. |
| 681 | * @param itemValue A pointer to the <code>null</code> terminated UTF-8 string that is the new |
| 682 | * value for the appropriate array item. |
| 683 | * @param options Option flags, none are defined at present. |
| 684 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 685 | */ |
| 686 | void setLocalizedText( |
| 687 | String schemaNS, |
| 688 | String altTextName, |
| 689 | String genericLang, |
| 690 | String specificLang, |
| 691 | String itemValue, |
| 692 | PropertyOptions options) throws XMPException; |
| 693 | |
| 694 | |
| 695 | /** |
| 696 | * @see XMPMeta#setLocalizedText(String, String, String, String, String, PropertyOptions) |
| 697 | * |
| 698 | * @param schemaNS The namespace URI for the alt-text array |
| 699 | * @param altTextName The name of the alt-text array |
| 700 | * @param genericLang The name of the generic language |
| 701 | * @param specificLang The name of the specific language |
| 702 | * @param itemValue the new value for the appropriate array item |
| 703 | * @throws XMPException Wraps all errors and exceptions |
| 704 | */ |
| 705 | void setLocalizedText( |
| 706 | String schemaNS, |
| 707 | String altTextName, |
| 708 | String genericLang, |
| 709 | String specificLang, |
| 710 | String itemValue) throws XMPException; |
| 711 | |
| 712 | |
| 713 | |
| 714 | // --------------------------------------------------------------------------------------------- |
| 715 | // Functions accessing properties as binary values. |
| 716 | |
| 717 | |
| 718 | /** |
| 719 | * These are very similar to <code>getProperty()</code> and <code>SetProperty()</code> above, |
| 720 | * but the value is returned or provided in a literal form instead of as a UTF-8 string. |
| 721 | * The path composition functions in <code>XMPPathFactory</code> may be used to compose an path |
| 722 | * expression for fields in nested structures, items in arrays, or qualifiers. |
| 723 | * |
| 724 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 725 | * <code>getProperty()</code>. |
| 726 | * @param propName The name of the property. |
| 727 | * Has the same usage as in <code>getProperty()</code>. |
| 728 | * @return Returns a <code>Boolean</code> value or <code>null</code> |
| 729 | * if the property does not exist. |
| 730 | * @throws XMPException Wraps all exceptions that may occur, |
| 731 | * especially conversion errors. |
| 732 | */ |
| 733 | Boolean getPropertyBoolean(String schemaNS, String propName) throws XMPException; |
| 734 | |
| 735 | |
| 736 | /** |
| 737 | * Convenience method to retrieve the literal value of a property. |
| 738 | * |
| 739 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 740 | * <code>getProperty()</code>. |
| 741 | * @param propName The name of the property. |
| 742 | * Has the same usage as in <code>getProperty()</code>. |
| 743 | * @return Returns an <code>Integer</code> value or <code>null</code> |
| 744 | * if the property does not exist. |
| 745 | * @throws XMPException Wraps all exceptions that may occur, |
| 746 | * especially conversion errors. |
| 747 | */ |
| 748 | Integer getPropertyInteger(String schemaNS, String propName) throws XMPException; |
| 749 | |
| 750 | |
| 751 | /** |
| 752 | * Convenience method to retrieve the literal value of a property. |
| 753 | * |
| 754 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 755 | * <code>getProperty()</code>. |
| 756 | * @param propName The name of the property. |
| 757 | * Has the same usage as in <code>getProperty()</code>. |
| 758 | * @return Returns a <code>Long</code> value or <code>null</code> |
| 759 | * if the property does not exist. |
| 760 | * @throws XMPException Wraps all exceptions that may occur, |
| 761 | * especially conversion errors. |
| 762 | */ |
| 763 | Long getPropertyLong(String schemaNS, String propName) throws XMPException; |
| 764 | |
| 765 | |
| 766 | /** |
| 767 | * Convenience method to retrieve the literal value of a property. |
| 768 | * |
| 769 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 770 | * <code>getProperty()</code>. |
| 771 | * @param propName The name of the property. |
| 772 | * Has the same usage as in <code>getProperty()</code>. |
| 773 | * @return Returns a <code>Double</code> value or <code>null</code> |
| 774 | * if the property does not exist. |
| 775 | * @throws XMPException Wraps all exceptions that may occur, |
| 776 | * especially conversion errors. |
| 777 | */ |
| 778 | Double getPropertyDouble(String schemaNS, String propName) throws XMPException; |
| 779 | |
| 780 | |
| 781 | /** |
| 782 | * Convenience method to retrieve the literal value of a property. |
| 783 | * |
| 784 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 785 | * <code>getProperty()</code>. |
| 786 | * @param propName The name of the property. |
| 787 | * Has the same usage as in <code>getProperty()</code>. |
| 788 | * @return Returns a <code>XMPDateTime</code>-object or <code>null</code> |
| 789 | * if the property does not exist. |
| 790 | * @throws XMPException Wraps all exceptions that may occur, |
| 791 | * especially conversion errors. |
| 792 | */ |
| 793 | XMPDateTime getPropertyDate(String schemaNS, String propName) throws XMPException; |
| 794 | |
| 795 | |
| 796 | /** |
| 797 | * Convenience method to retrieve the literal value of a property. |
| 798 | * |
| 799 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 800 | * <code>getProperty()</code>. |
| 801 | * @param propName The name of the property. |
| 802 | * Has the same usage as in <code>getProperty()</code>. |
| 803 | * @return Returns a Java <code>Calendar</code>-object or <code>null</code> |
| 804 | * if the property does not exist. |
| 805 | * @throws XMPException Wraps all exceptions that may occur, |
| 806 | * especially conversion errors. |
| 807 | */ |
| 808 | Calendar getPropertyCalendar(String schemaNS, String propName) throws XMPException; |
| 809 | |
| 810 | |
| 811 | /** |
| 812 | * Convenience method to retrieve the literal value of a property. |
| 813 | * |
| 814 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 815 | * <code>getProperty()</code>. |
| 816 | * @param propName The name of the property. |
| 817 | * Has the same usage as in <code>getProperty()</code>. |
| 818 | * @return Returns a <code>byte[]</code>-array contained the decoded base64 value |
| 819 | * or <code>null</code> if the property does not exist. |
| 820 | * @throws XMPException Wraps all exceptions that may occur, |
| 821 | * especially conversion errors. |
| 822 | */ |
| 823 | byte[] getPropertyBase64(String schemaNS, String propName) throws XMPException; |
| 824 | |
| 825 | |
| 826 | /** |
| 827 | * Convenience method to retrieve the literal value of a property. |
| 828 | * <em>Note:</em> There is no <code>setPropertyString()</code>, |
| 829 | * because <code>setProperty()</code> sets a string value. |
| 830 | * |
| 831 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 832 | * <code>getProperty()</code>. |
| 833 | * @param propName The name of the property. |
| 834 | * Has the same usage as in <code>getProperty()</code>. |
| 835 | * @return Returns a <code>String</code> value or <code>null</code> |
| 836 | * if the property does not exist. |
| 837 | * @throws XMPException Wraps all exceptions that may occur, |
| 838 | * especially conversion errors. |
| 839 | */ |
| 840 | String getPropertyString(String schemaNS, String propName) throws XMPException; |
| 841 | |
| 842 | |
| 843 | /** |
| 844 | * Convenience method to set a property to a literal <code>boolean</code> value. |
| 845 | * |
| 846 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 847 | * <code>setProperty()</code>. |
| 848 | * @param propName The name of the property. |
| 849 | * Has the same usage as in <code>getProperty()</code>. |
| 850 | * @param propValue the literal property value as <code>boolean</code>. |
| 851 | * @param options options of the property to set (optional). |
| 852 | * @throws XMPException Wraps all exceptions that may occur. |
| 853 | */ |
| 854 | void setPropertyBoolean( |
| 855 | String schemaNS, |
| 856 | String propName, |
| 857 | boolean propValue, |
| 858 | PropertyOptions options) throws XMPException; |
| 859 | |
| 860 | |
| 861 | /** |
| 862 | * @see XMPMeta#setPropertyBoolean(String, String, boolean, PropertyOptions) |
| 863 | * |
| 864 | * @param schemaNS The namespace URI for the property |
| 865 | * @param propName The name of the property |
| 866 | * @param propValue the literal property value as <code>boolean</code> |
| 867 | * @throws XMPException Wraps all exceptions |
| 868 | */ |
| 869 | void setPropertyBoolean( |
| 870 | String schemaNS, |
| 871 | String propName, |
| 872 | boolean propValue) throws XMPException; |
| 873 | |
| 874 | |
| 875 | /** |
| 876 | * Convenience method to set a property to a literal <code>int</code> value. |
| 877 | * |
| 878 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 879 | * <code>setProperty()</code>. |
| 880 | * @param propName The name of the property. |
| 881 | * Has the same usage as in <code>getProperty()</code>. |
| 882 | * @param propValue the literal property value as <code>int</code>. |
| 883 | * @param options options of the property to set (optional). |
| 884 | * @throws XMPException Wraps all exceptions that may occur. |
| 885 | */ |
| 886 | void setPropertyInteger( |
| 887 | String schemaNS, |
| 888 | String propName, |
| 889 | int propValue, |
| 890 | PropertyOptions options) throws XMPException; |
| 891 | |
| 892 | |
| 893 | /** |
| 894 | * @see XMPMeta#setPropertyInteger(String, String, int, PropertyOptions) |
| 895 | * |
| 896 | * @param schemaNS The namespace URI for the property |
| 897 | * @param propName The name of the property |
| 898 | * @param propValue the literal property value as <code>int</code> |
| 899 | * @throws XMPException Wraps all exceptions |
| 900 | */ |
| 901 | void setPropertyInteger( |
| 902 | String schemaNS, |
| 903 | String propName, |
| 904 | int propValue) throws XMPException; |
| 905 | |
| 906 | |
| 907 | /** |
| 908 | * Convenience method to set a property to a literal <code>long</code> value. |
| 909 | * |
| 910 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 911 | * <code>setProperty()</code>. |
| 912 | * @param propName The name of the property. |
| 913 | * Has the same usage as in <code>getProperty()</code>. |
| 914 | * @param propValue the literal property value as <code>long</code>. |
| 915 | * @param options options of the property to set (optional). |
| 916 | * @throws XMPException Wraps all exceptions that may occur. |
| 917 | */ |
| 918 | void setPropertyLong( |
| 919 | String schemaNS, |
| 920 | String propName, |
| 921 | long propValue, |
| 922 | PropertyOptions options) throws XMPException; |
| 923 | |
| 924 | |
| 925 | /** |
| 926 | * @see XMPMeta#setPropertyLong(String, String, long, PropertyOptions) |
| 927 | * |
| 928 | * @param schemaNS The namespace URI for the property |
| 929 | * @param propName The name of the property |
| 930 | * @param propValue the literal property value as <code>long</code> |
| 931 | * @throws XMPException Wraps all exceptions |
| 932 | */ |
| 933 | void setPropertyLong( |
| 934 | String schemaNS, |
| 935 | String propName, |
| 936 | long propValue) throws XMPException; |
| 937 | |
| 938 | |
| 939 | /** |
| 940 | * Convenience method to set a property to a literal <code>double</code> value. |
| 941 | * |
| 942 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 943 | * <code>setProperty()</code>. |
| 944 | * @param propName The name of the property. |
| 945 | * Has the same usage as in <code>getProperty()</code>. |
| 946 | * @param propValue the literal property value as <code>double</code>. |
| 947 | * @param options options of the property to set (optional). |
| 948 | * @throws XMPException Wraps all exceptions that may occur. |
| 949 | */ |
| 950 | void setPropertyDouble( |
| 951 | String schemaNS, |
| 952 | String propName, |
| 953 | double propValue, |
| 954 | PropertyOptions options) throws XMPException; |
| 955 | |
| 956 | |
| 957 | /** |
| 958 | * @see XMPMeta#setPropertyDouble(String, String, double, PropertyOptions) |
| 959 | * |
| 960 | * @param schemaNS The namespace URI for the property |
| 961 | * @param propName The name of the property |
| 962 | * @param propValue the literal property value as <code>double</code> |
| 963 | * @throws XMPException Wraps all exceptions |
| 964 | */ |
| 965 | void setPropertyDouble( |
| 966 | String schemaNS, |
| 967 | String propName, |
| 968 | double propValue) throws XMPException; |
| 969 | |
| 970 | |
| 971 | /** |
| 972 | * Convenience method to set a property with an XMPDateTime-object, |
| 973 | * which is serialized to an ISO8601 date. |
| 974 | * |
| 975 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 976 | * <code>setProperty()</code>. |
| 977 | * @param propName The name of the property. |
| 978 | * Has the same usage as in <code>getProperty()</code>. |
| 979 | * @param propValue the property value as <code>XMPDateTime</code>. |
| 980 | * @param options options of the property to set (optional). |
| 981 | * @throws XMPException Wraps all exceptions that may occur. |
| 982 | */ |
| 983 | void setPropertyDate( |
| 984 | String schemaNS, |
| 985 | String propName, |
| 986 | XMPDateTime propValue, |
| 987 | PropertyOptions options) throws XMPException; |
| 988 | |
| 989 | |
| 990 | /** |
| 991 | * @see XMPMeta#setPropertyDate(String, String, XMPDateTime, PropertyOptions) |
| 992 | * |
| 993 | * @param schemaNS The namespace URI for the property |
| 994 | * @param propName The name of the property |
| 995 | * @param propValue the property value as <code>XMPDateTime</code> |
| 996 | * @throws XMPException Wraps all exceptions |
| 997 | */ |
| 998 | void setPropertyDate( |
| 999 | String schemaNS, |
| 1000 | String propName, |
| 1001 | XMPDateTime propValue) throws XMPException; |
| 1002 | |
| 1003 | |
| 1004 | /** |
| 1005 | * Convenience method to set a property with a Java Calendar-object, |
| 1006 | * which is serialized to an ISO8601 date. |
| 1007 | * |
| 1008 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 1009 | * <code>setProperty()</code>. |
| 1010 | * @param propName The name of the property. |
| 1011 | * Has the same usage as in <code>getProperty()</code>. |
| 1012 | * @param propValue the property value as Java <code>Calendar</code>. |
| 1013 | * @param options options of the property to set (optional). |
| 1014 | * @throws XMPException Wraps all exceptions that may occur. |
| 1015 | */ |
| 1016 | void setPropertyCalendar( |
| 1017 | String schemaNS, |
| 1018 | String propName, |
| 1019 | Calendar propValue, |
| 1020 | PropertyOptions options) throws XMPException; |
| 1021 | |
| 1022 | |
| 1023 | /** |
| 1024 | * @see XMPMeta#setPropertyCalendar(String, String, Calendar, PropertyOptions) |
| 1025 | * |
| 1026 | * @param schemaNS The namespace URI for the property |
| 1027 | * @param propName The name of the property |
| 1028 | * @param propValue the property value as <code>Calendar</code> |
| 1029 | * @throws XMPException Wraps all exceptions |
| 1030 | */ |
| 1031 | void setPropertyCalendar( |
| 1032 | String schemaNS, |
| 1033 | String propName, |
| 1034 | Calendar propValue) throws XMPException; |
| 1035 | |
| 1036 | |
| 1037 | /** |
| 1038 | * Convenience method to set a property from a binary <code>byte[]</code>-array, |
| 1039 | * which is serialized as base64-string. |
| 1040 | * |
| 1041 | * @param schemaNS The namespace URI for the property. Has the same usage as in |
| 1042 | * <code>setProperty()</code>. |
| 1043 | * @param propName The name of the property. |
| 1044 | * Has the same usage as in <code>getProperty()</code>. |
| 1045 | * @param propValue the literal property value as byte array. |
| 1046 | * @param options options of the property to set (optional). |
| 1047 | * @throws XMPException Wraps all exceptions that may occur. |
| 1048 | */ |
| 1049 | void setPropertyBase64( |
| 1050 | String schemaNS, |
| 1051 | String propName, |
| 1052 | byte[] propValue, |
| 1053 | PropertyOptions options) throws XMPException; |
| 1054 | |
| 1055 | |
| 1056 | /** |
| 1057 | * @see XMPMeta#setPropertyBase64(String, String, byte[], PropertyOptions) |
| 1058 | * |
| 1059 | * @param schemaNS The namespace URI for the property |
| 1060 | * @param propName The name of the property |
| 1061 | * @param propValue the literal property value as byte array |
| 1062 | * @throws XMPException Wraps all exceptions |
| 1063 | */ |
| 1064 | void setPropertyBase64( |
| 1065 | String schemaNS, |
| 1066 | String propName, |
| 1067 | byte[] propValue) throws XMPException; |
| 1068 | |
| 1069 | |
| 1070 | /** |
| 1071 | * Constructs an iterator for the properties within this XMP object. |
| 1072 | * |
| 1073 | * @return Returns an <code>XMPIterator</code>. |
| 1074 | * @see XMPMeta#iterator(String, String, IteratorOptions) |
| 1075 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 1076 | */ |
| 1077 | XMPIterator iterator() throws XMPException; |
| 1078 | |
| 1079 | |
| 1080 | /** |
| 1081 | * Constructs an iterator for the properties within this XMP object using some options. |
| 1082 | * |
| 1083 | * @param options Option flags to control the iteration. |
| 1084 | * @return Returns an <code>XMPIterator</code>. |
| 1085 | * @see XMPMeta#iterator(String, String, IteratorOptions) |
| 1086 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 1087 | */ |
| 1088 | XMPIterator iterator(IteratorOptions options) throws XMPException; |
| 1089 | |
| 1090 | |
| 1091 | /** |
| 1092 | * Construct an iterator for the properties within an XMP object. According to the parameters it iterates the entire data tree, |
| 1093 | * properties within a specific schema, or a subtree rooted at a specific node. |
| 1094 | * |
| 1095 | * @param schemaNS Optional schema namespace URI to restrict the iteration. Omitted (visit all |
| 1096 | * schema) by passing <code>null</code> or empty String. |
| 1097 | * @param propName Optional property name to restrict the iteration. May be an arbitrary path |
| 1098 | * expression. Omitted (visit all properties) by passing <code>null</code> or empty |
| 1099 | * String. If no schema URI is given, it is ignored. |
| 1100 | * @param options Option flags to control the iteration. See {@link IteratorOptions} for |
| 1101 | * details. |
| 1102 | * @return Returns an <code>XMPIterator</code> for this <code>XMPMeta</code>-object |
| 1103 | * considering the given options. |
| 1104 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 1105 | */ |
| 1106 | XMPIterator iterator( |
| 1107 | String schemaNS, |
| 1108 | String propName, |
| 1109 | IteratorOptions options) throws XMPException; |
| 1110 | |
| 1111 | |
| 1112 | /** |
| 1113 | * This correlates to the about-attribute, |
| 1114 | * returns the empty String if no name is set. |
| 1115 | * |
| 1116 | * @return Returns the name of the XMP object. |
| 1117 | */ |
| 1118 | String getObjectName(); |
| 1119 | |
| 1120 | |
| 1121 | /** |
| 1122 | * @param name Sets the name of the XMP object. |
| 1123 | */ |
| 1124 | void setObjectName(String name); |
| 1125 | |
| 1126 | |
| 1127 | /** |
| 1128 | * @return Returns the unparsed content of the <?xpacket> processing instruction. |
| 1129 | * This contains normally the attribute-like elements 'begin="<BOM>" |
| 1130 | * id="W5M0MpCehiHzreSzNTczkc9d"' and possibly the deprecated elements 'bytes="1234"' or |
| 1131 | * 'encoding="XXX"'. If the parsed packet has not been wrapped into an xpacket, |
| 1132 | * <code>null</code> is returned. |
| 1133 | */ |
| 1134 | String getPacketHeader(); |
| 1135 | |
| 1136 | |
| 1137 | /** |
| 1138 | * Clones the complete metadata tree. |
| 1139 | * |
| 1140 | * @return Returns a deep copy of this instance. |
| 1141 | */ |
| 1142 | Object clone(); |
| 1143 | |
| 1144 | |
| 1145 | /** |
| 1146 | * Sorts the complete datamodel according to the following rules: |
| 1147 | * <ul> |
| 1148 | * <li>Schema nodes are sorted by prefix. |
| 1149 | * <li>Properties at top level and within structs are sorted by full name, that is |
| 1150 | * prefix + local name. |
| 1151 | * <li>Array items are not sorted, even if they have no certain order such as bags. |
| 1152 | * <li>Qualifier are sorted, with the exception of "xml:lang" and/or "rdf:type" |
| 1153 | * that stay at the top of the list in that order. |
| 1154 | * </ul> |
| 1155 | */ |
| 1156 | void sort(); |
| 1157 | |
| 1158 | |
| 1159 | /** |
| 1160 | * Perform the normalization as a separate parsing step. |
| 1161 | * Normally it is done during parsing, unless the parsing option |
| 1162 | * {@link ParseOptions#OMIT_NORMALIZATION} is set to <code>true</code>. |
| 1163 | * <em>Note:</em> It does no harm to call this method to an already normalized xmp object. |
| 1164 | * It was a PDF/A requirement to get hand on the unnormalized <code>XMPMeta</code> object. |
| 1165 | * |
| 1166 | * @param options optional parsing options. |
| 1167 | * @throws XMPException Wraps all errors and exceptions that may occur. |
| 1168 | */ |
| 1169 | void normalize(ParseOptions options) throws XMPException; |
| 1170 | |
| 1171 | |
| 1172 | /** |
| 1173 | * Renders this node and the tree unter this node in a human readable form. |
| 1174 | * @return Returns a multiline string containing the dump. |
| 1175 | */ |
| 1176 | String dumpObject(); |
| 1177 | } |