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 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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 (ResourceEventProducer)broadcaster.getEventProducerFor(
  44. ResourceEventProducer.class);
  45. }
  46. }
  47. /**
  48. * Image not found.
  49. * @param source the event source
  50. * @param uri the original URI of the image
  51. * @param fnfe the "file not found" exception
  52. * @param loc the location of the error or null
  53. * @event.severity ERROR
  54. */
  55. void imageNotFound(Object source, String uri, FileNotFoundException fnfe, Locator loc);
  56. /**
  57. * Error while processing image.
  58. * @param source the event source
  59. * @param uri the original URI of the image
  60. * @param e the image exception
  61. * @param loc the location of the error or null
  62. * @event.severity ERROR
  63. */
  64. void imageError(Object source, String uri, ImageException e, Locator loc);
  65. /**
  66. * I/O error while loading an image.
  67. * @param source the event source
  68. * @param uri the original URI of the image
  69. * @param ioe the I/O exception
  70. * @param loc the location of the error or null
  71. * @event.severity ERROR
  72. */
  73. void imageIOError(Object source, String uri, IOException ioe, Locator loc);
  74. /**
  75. * Error while writing/serializing an image to an output format.
  76. * @param source the event source
  77. * @param e the original exception
  78. * @event.severity ERROR
  79. */
  80. void imageWritingError(Object source, Exception e);
  81. /**
  82. * Error while handling a URI.
  83. * @param source the event source
  84. * @param uri the original URI of the image
  85. * @param e the original exception
  86. * @param loc the location of the error or null
  87. * @event.severity ERROR
  88. */
  89. void uriError(Object source, String uri, Exception e, Locator loc);
  90. /**
  91. * Intrinsic size of fo:instream-foreign-object could not be determined.
  92. * @param source the event source
  93. * @param loc the location of the error or null
  94. * @event.severity ERROR
  95. */
  96. void ifoNoIntrinsicSize(Object source, Locator loc);
  97. /**
  98. * Error processing foreign XML content.
  99. * @param source the event source
  100. * @param doc the foreign XML
  101. * @param namespaceURI the namespace URI of the foreign XML
  102. * @param e the original exception
  103. * @event.severity ERROR
  104. */
  105. void foreignXMLProcessingError(Object source, Document doc, String namespaceURI, Exception e);
  106. /**
  107. * No handler for foreign XML content.
  108. * @param source the event source
  109. * @param doc the foreign XML
  110. * @param namespaceURI the namespace URI of the foreign XML
  111. * @event.severity ERROR
  112. */
  113. void foreignXMLNoHandler(Object source, Document doc, String namespaceURI);
  114. /**
  115. * Cannot delete a temporary file.
  116. * @param source the event source
  117. * @param tempFile the temporary file
  118. * @event.severity ERROR
  119. */
  120. void cannotDeleteTempFile(Object source, File tempFile);
  121. /**
  122. * Catalog Resolver not found along the class path
  123. * @param source the event source
  124. * @event.severity ERROR
  125. */
  126. void catalogResolverNotFound(Object source);
  127. /**
  128. * Catalog Resolver not created, due to InstantiationException or IllegalAccessException
  129. * @param source the event source
  130. * @param message the exception message
  131. * @event.severity ERROR
  132. */
  133. void catalogResolverNotCreated(Object source, String message);
  134. }