You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

XMPMetadata.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.fo.extensions.xmp;
  19. import java.io.Serializable;
  20. import org.apache.fop.fo.extensions.ExtensionAttachment;
  21. import org.apache.xmlgraphics.util.XMLizable;
  22. import org.apache.xmlgraphics.xmp.Metadata;
  23. import org.apache.xmlgraphics.xmp.XMPConstants;
  24. import org.xml.sax.ContentHandler;
  25. import org.xml.sax.SAXException;
  26. /**
  27. * This is the pass-through value object for the XMP metadata extension.
  28. */
  29. public class XMPMetadata implements ExtensionAttachment, Serializable, XMLizable {
  30. /** The category URI for this extension attachment. */
  31. public static final String CATEGORY = XMPConstants.XMP_NAMESPACE;
  32. private Metadata meta;
  33. private boolean readOnly = true;
  34. /**
  35. * No-argument contructor.
  36. */
  37. public XMPMetadata() {
  38. //nop
  39. }
  40. /**
  41. * Default constructor.
  42. * @param metadata the XMP metadata
  43. */
  44. public XMPMetadata(Metadata metadata) {
  45. this.meta = metadata;
  46. }
  47. /** @return the XMP metadata */
  48. public Metadata getMetadata() {
  49. return this.meta;
  50. }
  51. /**
  52. * Sets the XMP metadata.
  53. * @param metadata the XMP metadata
  54. */
  55. public void setMetadata(Metadata metadata) {
  56. this.meta = metadata;
  57. }
  58. /** @return true if the XMP metadata is marked read-only. */
  59. public boolean isReadOnly() {
  60. return readOnly;
  61. }
  62. /**
  63. * Sets the flag that decides whether a metadata packet may be modified.
  64. * @param readOnly true if the XMP metadata packet should be marked read-only.
  65. */
  66. public void setReadOnly(boolean readOnly) {
  67. this.readOnly = readOnly;
  68. }
  69. /** {@inheritDoc} */
  70. public String getCategory() {
  71. return CATEGORY;
  72. }
  73. /** {@inheritDoc} */
  74. public void toSAX(ContentHandler handler) throws SAXException {
  75. getMetadata().toSAX(handler);
  76. }
  77. }