File tree Expand file tree Collapse file tree 8 files changed +40
-7
lines changed
fcrepo-dto-core/src/main/java/com/github/cwilper/fcrepo/dto/core/io
fcrepo-dto-foxml/src/main/java/com/github/cwilper/fcrepo/dto/foxml Expand file tree Collapse file tree 8 files changed +40
-7
lines changed Original file line number Diff line number Diff line change 2
2
.idea
3
3
* .log
4
4
* .iml
5
+ * .swp
5
6
.DS_Store
6
7
.settings
7
8
.project
Original file line number Diff line number Diff line change 8
8
*/
9
9
public abstract class ContentHandlingDTOReader implements DTOReader {
10
10
11
- private final ContentHandler defaultContentHandler =
11
+ protected final ContentHandler defaultContentHandler =
12
12
new DefaultContentHandler ();
13
13
14
14
protected ContentHandler contentHandler ;
Original file line number Diff line number Diff line change 9
9
*/
10
10
public abstract class ContentResolvingDTOWriter implements DTOWriter {
11
11
12
- private final ContentResolver defaultContentResolver =
12
+ protected final ContentResolver defaultContentResolver =
13
13
new DefaultContentResolver ();
14
14
15
15
protected ContentResolver contentResolver ;
Original file line number Diff line number Diff line change 9
9
* Interface for reading a {@link FedoraObject} from a stream.
10
10
*/
11
11
public interface DTOReader {
12
+ /**
13
+ * Gets a new instance configured like this one.
14
+ *
15
+ * @return a new instance.
16
+ */
17
+ DTOReader getInstance ();
12
18
13
19
/**
14
20
* Deserializes the given stream into a <code>FedoraObject</code>.
Original file line number Diff line number Diff line change 9
9
* Interface for writing a {@link FedoraObject} to a stream.
10
10
*/
11
11
public interface DTOWriter {
12
+ /**
13
+ * Gets a new instance configured like this one.
14
+ *
15
+ * @return the instance.
16
+ */
17
+ DTOWriter getInstance ();
12
18
13
19
/**
14
20
* Serializes a <code>FedoraObject</code> to the given stream.
Original file line number Diff line number Diff line change 9
9
import com .github .cwilper .fcrepo .dto .core .State ;
10
10
import com .github .cwilper .fcrepo .dto .core .io .ContentHandlingDTOReader ;
11
11
import com .github .cwilper .fcrepo .dto .core .io .DateUtil ;
12
+ import com .github .cwilper .fcrepo .dto .core .io .DTOReader ;
12
13
import com .github .cwilper .fcrepo .dto .core .io .XMLUtil ;
13
14
import org .apache .commons .codec .binary .Base64OutputStream ;
14
15
import org .apache .commons .io .IOUtils ;
30
31
import java .util .Set ;
31
32
32
33
/**
33
- * A {@link com.github.cwilper.fcrepo.dto.core.io.DTOReader} that reads
34
- * Fedora Object XML.
34
+ * A {@link DTOReader} that reads Fedora Object XML.
35
35
* <p>
36
36
* <b>NOTE:</b> Only FOXML version 1.1 is supported.
37
37
*
@@ -52,6 +52,15 @@ public class FOXMLReader extends ContentHandlingDTOReader {
52
52
public FOXMLReader () {
53
53
}
54
54
55
+ @ Override
56
+ public DTOReader getInstance () {
57
+ FOXMLReader reader = new FOXMLReader ();
58
+ if (contentHandler != defaultContentHandler ) {
59
+ reader .setContentHandler (contentHandler );
60
+ }
61
+ return reader ;
62
+ }
63
+
55
64
@ Override
56
65
public FedoraObject readObject (InputStream source ) throws IOException {
57
66
obj = new FedoraObject ();
Original file line number Diff line number Diff line change 22
22
import com .github .cwilper .fcrepo .dto .core .State ;
23
23
import com .github .cwilper .fcrepo .dto .core .io .ContentResolvingDTOWriter ;
24
24
import com .github .cwilper .fcrepo .dto .core .io .DateUtil ;
25
+ import com .github .cwilper .fcrepo .dto .core .io .DTOWriter ;
25
26
import com .github .cwilper .fcrepo .dto .core .io .XMLUtil ;
26
27
27
28
/**
28
- * A {@link com.github.cwilper.fcrepo.dto.core.io.DTOWriter} that writes
29
- * Fedora Object XML.
29
+ * A {@link DTOWriter} that writes Fedora Object XML.
30
30
* <p>
31
31
* <b>NOTE:</b> Only FOXML version 1.1 is supported.
32
32
*
@@ -49,6 +49,18 @@ public void setManagedDatastreamsToEmbed(
49
49
this .managedDatastreamsToEmbed = managedDatastreamsToEmbed ;
50
50
}
51
51
52
+ @ Override
53
+ public DTOWriter getInstance () {
54
+ FOXMLWriter writer = new FOXMLWriter ();
55
+ if (contentResolver != defaultContentResolver ) {
56
+ writer .setContentResolver (contentResolver );
57
+ }
58
+ writer .setManagedDatastreamsToEmbed (
59
+ new HashSet <String >(managedDatastreamsToEmbed ));
60
+ return writer ;
61
+ }
62
+
63
+ @ Override
52
64
public void writeObject (FedoraObject obj , OutputStream sink )
53
65
throws IOException {
54
66
this .obj = obj ;
Original file line number Diff line number Diff line change 272
272
<artifactId >maven-compiler-plugin</artifactId >
273
273
<version >2.3.1</version >
274
274
<configuration >
275
- <debug >true</debug >
276
275
<source >1.6</source >
277
276
<target >1.6</target >
278
277
</configuration >
You can’t perform that action at this time.
0 commit comments