|
18 | 18 | */
|
19 | 19 | package de.catma.document.source.contenthandler;
|
20 | 20 |
|
21 |
| -import java.io.IOException; |
22 |
| -import java.io.InputStream; |
23 |
| - |
24 | 21 | import de.catma.document.source.FileType;
|
25 | 22 | import de.catma.document.source.SourceDocument;
|
26 | 23 | import de.catma.document.source.SourceDocumentInfo;
|
| 24 | +import de.catma.document.source.TechInfoSet; |
| 25 | + |
| 26 | +import java.io.IOException; |
27 | 27 |
|
28 | 28 | /**
|
29 |
| - * A content handler for a source document. The content handler is responsible for |
30 |
| - * loading content from a source document and keeping it in memory. |
| 29 | + * A content handler for a {@link SourceDocument}. It is responsible for loading content from a source document and keeping it in memory. |
31 | 30 | * <p>
|
32 | 31 | * It uses the proper encoding and {@link FileType}.
|
33 |
| - * <p> |
34 |
| - * <strong>SourceContentHandler implementations need to have a default no-arg constructor!</strong> |
35 | 32 | */
|
36 | 33 | public interface SourceContentHandler {
|
37 |
| - |
38 | 34 | /**
|
39 |
| - * @param sourceDocumentInfo all the metadata for the {@link SourceDocument}, has |
40 |
| - * to be set right after instance creation completed |
| 35 | + * Sets all the metadata for the source document with which this instance is associated. Must be called immediately after instantiation. |
| 36 | + * |
| 37 | + * @param sourceDocumentInfo a {@link SourceDocumentInfo} object containing the metadata |
41 | 38 | */
|
42 |
| - public void setSourceDocumentInfo( |
43 |
| - SourceDocumentInfo sourceDocumentInfo); |
44 |
| - |
| 39 | + void setSourceDocumentInfo(SourceDocumentInfo sourceDocumentInfo); |
| 40 | + |
45 | 41 | /**
|
46 |
| - * @return all the metadata for the {@link SourceDocument} |
| 42 | + * Returns all the metadata for the source document with which this instance is associated. |
| 43 | + * |
| 44 | + * @return a {@link SourceDocumentInfo} object containing the metadata |
47 | 45 | */
|
48 |
| - public SourceDocumentInfo getSourceDocumentInfo(); |
49 |
| - |
| 46 | + SourceDocumentInfo getSourceDocumentInfo(); |
| 47 | + |
50 | 48 | /**
|
51 |
| - * @param is the {@link SourceDocument} as raw data. |
52 |
| - * @throws IOException error accessing the input stream. |
| 49 | + * Loads the content of the source document with which this instance is associated. |
| 50 | + * <p> |
| 51 | + * Loading is performed from the resource identified via {@link TechInfoSet#getURI()} of the {@link SourceDocumentInfo}. |
| 52 | + * |
| 53 | + * @throws IOException if an error occurs while loading the content |
53 | 54 | */
|
54 |
| - public void load(InputStream is) throws IOException; |
| 55 | + void load() throws IOException; |
| 56 | + |
55 | 57 | /**
|
56 |
| - * Loading via {@link de.catma.document.source.TechInfoSet#getURI()} of the {@link SourceDocumentInfo}. |
57 |
| - * @throws IOException error accessing {@link de.catma.document.source.TechInfoSet#getURI()}. |
| 58 | + * Returns the content of the source document with which this instance is associated. |
| 59 | + * |
| 60 | + * @return the entire document text |
| 61 | + * @throws IOException if an error occurs while loading the content |
58 | 62 | */
|
59 |
| - public void load() throws IOException; |
60 |
| - |
| 63 | + String getContent() throws IOException; |
| 64 | + |
61 | 65 | /**
|
62 |
| - * @return the extracted text of the {@link SourceDocument}. |
63 |
| - * @throws IOException |
| 66 | + * Discards the content of the source document with which this instance is associated. |
64 | 67 | */
|
65 |
| - public String getContent() throws IOException; |
66 |
| - |
| 68 | + void unload(); |
| 69 | + |
67 | 70 | /**
|
68 |
| - * Discards the content. |
| 71 | + * Whether the content of the source document with which this instance is associated has been loaded. |
| 72 | + * |
| 73 | + * @return <code>true</code> if the content has been loaded, <code>false</code> if the content has not yet been loaded or was unloaded via |
| 74 | + * {@link SourceContentHandler#unload()} |
69 | 75 | */
|
70 |
| - public void unload(); |
71 |
| - |
| 76 | + boolean isLoaded(); |
| 77 | + |
72 | 78 | /**
|
73 |
| - * @return <code>true</code> if the content has been loaded and not yet unloaded, else <code>false</code>. |
| 79 | + * Whether the source document with which this instance is associated contains embedded annotations. |
| 80 | + * <p> |
| 81 | + * Can only be true for XML documents. |
| 82 | + * |
| 83 | + * @return <code>true</code> if embedded annotations exist, otherwise <code>false</code> |
74 | 84 | */
|
75 |
| - public boolean isLoaded(); |
76 |
| - |
77 |
| - public boolean hasIntrinsicMarkupCollection(); |
78 |
| - |
| 85 | + @Deprecated |
| 86 | + boolean hasIntrinsicAnnotationCollection(); |
79 | 87 | }
|
0 commit comments