aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/ResourceEventProducer.java
blob: 18293ff06a9773bbd8bda3807070da8eadf46542 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* $Id$ */

package org.apache.fop;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.w3c.dom.Document;
import org.xml.sax.Locator;

import org.apache.xmlgraphics.image.loader.ImageException;

import org.apache.fop.events.EventBroadcaster;
import org.apache.fop.events.EventProducer;

/**
 * Event producer interface for resource events (missing images, fonts etc.).
 */
public interface ResourceEventProducer extends EventProducer {

    /**
     * Provider class for the event producer.
     */
    final class Provider {

        private Provider() {
        }

        /**
         * Returns an event producer.
         * @param broadcaster the event broadcaster to use
         * @return the requested event producer
         */
        public static ResourceEventProducer get(EventBroadcaster broadcaster) {
            return (ResourceEventProducer)broadcaster.getEventProducerFor(
                    ResourceEventProducer.class);
        }
    }

    /**
     * Image not found.
     * @param source the event source
     * @param uri the original URI of the image
     * @param fnfe the "file not found" exception
     * @param loc the location of the error or null
     * @event.severity ERROR
     */
    void imageNotFound(Object source, String uri, FileNotFoundException fnfe, Locator loc);

    /**
     * Error while processing image.
     * @param source the event source
     * @param uri the original URI of the image
     * @param e the image exception
     * @param loc the location of the error or null
     * @event.severity ERROR
     */
    void imageError(Object source, String uri, ImageException e, Locator loc);

    /**
     * I/O error while loading an image.
     * @param source the event source
     * @param uri the original URI of the image
     * @param ioe the I/O exception
     * @param loc the location of the error or null
     * @event.severity ERROR
     */
    void imageIOError(Object source, String uri, IOException ioe, Locator loc);

    /**
     * Error while writing/serializing an image to an output format.
     * @param source the event source
     * @param e the original exception
     * @event.severity ERROR
     */
    void imageWritingError(Object source, Exception e);

    /**
     * Error while handling a URI.
     * @param source the event source
     * @param uri the original URI of the image
     * @param e the original exception
     * @param loc the location of the error or null
     * @event.severity ERROR
     */
    void uriError(Object source, String uri, Exception e, Locator loc);

    /**
     * Intrinsic size of fo:instream-foreign-object could not be determined.
     * @param source the event source
     * @param loc the location of the error or null
     * @event.severity ERROR
     */
    void ifoNoIntrinsicSize(Object source, Locator loc);

    /**
     * Error processing foreign XML content.
     * @param source the event source
     * @param doc the foreign XML
     * @param namespaceURI the namespace URI of the foreign XML
     * @param e the original exception
     * @event.severity ERROR
     */
    void foreignXMLProcessingError(Object source, Document doc, String namespaceURI, Exception e);

    /**
     * No handler for foreign XML content.
     * @param source the event source
     * @param doc the foreign XML
     * @param namespaceURI the namespace URI of the foreign XML
     * @event.severity ERROR
     */
    void foreignXMLNoHandler(Object source, Document doc, String namespaceURI);

    /**
     * Cannot delete a temporary file.
     * @param source the event source
     * @param tempFile the temporary file
     * @event.severity ERROR
     */
    void cannotDeleteTempFile(Object source, File tempFile);

    /**
     * Catalog Resolver not found along the class path
     * @param source the event source
     * @event.severity ERROR
     */
    void catalogResolverNotFound(Object source);

    /**
     * Catalog Resolver not created, due to InstantiationException or IllegalAccessException
     * @param source the event source
     * @param message the exception message
     * @event.severity ERROR
     */
    void catalogResolverNotCreated(Object source, String message);

    /**
     * Warning in an image.
     * @param source the event source
     * @param message warning
     * @event.severity WARN
     */
    void imageWarning(Object source, String message);
}