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.

ResourceEventProducer.java 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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;
  19. import java.io.File;
  20. import java.io.FileNotFoundException;
  21. import java.io.IOException;
  22. import org.w3c.dom.Document;
  23. import org.xml.sax.Locator;
  24. import org.apache.xmlgraphics.image.loader.ImageException;
  25. import org.apache.fop.events.EventBroadcaster;
  26. import org.apache.fop.events.EventProducer;
  27. /**
  28. * Event producer interface for resource events (missing images, fonts etc.).
  29. */
  30. public interface ResourceEventProducer extends EventProducer {
  31. /**
  32. * Provider class for the event producer.
  33. */
  34. final class Provider {
  35. private Provider() {
  36. }
  37. /**
  38. * Returns an event producer.
  39. * @param broadcaster the event broadcaster to use
  40. * @return the requested event producer
  41. */
  42. public static ResourceEventProducer get(EventBroadcaster broadcaster) {
  43. return broadcaster.getEventProducerFor(ResourceEventProducer.class);
  44. }
  45. }
  46. /**
  47. * Image not found.
  48. * @param source the event source
  49. * @param uri the original URI of the image
  50. * @param fnfe the "file not found" exception
  51. * @param loc the location of the error or null
  52. * @event.severity ERROR
  53. */
  54. void imageNotFound(Object source, String uri, FileNotFoundException fnfe, Locator loc);
  55. /**
  56. * Error while processing image.
  57. * @param source the event source
  58. * @param uri the original URI of the image
  59. * @param e the image exception
  60. * @param loc the location of the error or null
  61. * @event.severity ERROR
  62. */
  63. void imageError(Object source, String uri, ImageException e, Locator loc);
  64. /**
  65. * I/O error while loading an image.
  66. * @param source the event source
  67. * @param uri the original URI of the image
  68. * @param ioe the I/O exception
  69. * @param loc the location of the error or null
  70. * @event.severity ERROR
  71. */
  72. void imageIOError(Object source, String uri, IOException ioe, Locator loc);
  73. /**
  74. * Error while writing/serializing an image to an output format.
  75. * @param source the event source
  76. * @param e the original exception
  77. * @event.severity ERROR
  78. */
  79. void imageWritingError(Object source, Exception e);
  80. /**
  81. * Error while handling a URI.
  82. * @param source the event source
  83. * @param uri the original URI of the image
  84. * @param e the original exception
  85. * @param loc the location of the error or null
  86. * @event.severity ERROR
  87. */
  88. void uriError(Object source, String uri, Exception e, Locator loc);
  89. /**
  90. * Intrinsic size of fo:instream-foreign-object could not be determined.
  91. * @param source the event source
  92. * @param loc the location of the error or null
  93. * @event.severity ERROR
  94. */
  95. void ifoNoIntrinsicSize(Object source, Locator loc);
  96. /**
  97. * Error processing foreign XML content.
  98. * @param source the event source
  99. * @param doc the foreign XML
  100. * @param namespaceURI the namespace URI of the foreign XML
  101. * @param e the original exception
  102. * @event.severity ERROR
  103. */
  104. void foreignXMLProcessingError(Object source, Document doc, String namespaceURI, Exception e);
  105. /**
  106. * No handler for foreign XML content.
  107. * @param source the event source
  108. * @param doc the foreign XML
  109. * @param namespaceURI the namespace URI of the foreign XML
  110. * @event.severity ERROR
  111. */
  112. void foreignXMLNoHandler(Object source, Document doc, String namespaceURI);
  113. /**
  114. * Cannot delete a temporary file.
  115. * @param source the event source
  116. * @param tempFile the temporary file
  117. * @event.severity ERROR
  118. */
  119. void cannotDeleteTempFile(Object source, File tempFile);
  120. /**
  121. * Catalog Resolver not found along the class path
  122. * @param source the event source
  123. * @event.severity ERROR
  124. */
  125. void catalogResolverNotFound(Object source);
  126. /**
  127. * Catalog Resolver not created, due to InstantiationException or IllegalAccessException
  128. * @param source the event source
  129. * @param message the exception message
  130. * @event.severity ERROR
  131. */
  132. void catalogResolverNotCreated(Object source, String message);
  133. /**
  134. * Warning in an image.
  135. * @param source the event source
  136. * @param message warning
  137. * @event.severity WARN
  138. */
  139. void imageWarning(Object source, String message);
  140. }