]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/jackrabbit/remote/IOHandlerWrapper.java
1 package org
.argeo
.jackrabbit
.remote
;
3 import java
.io
.IOException
;
5 import org
.apache
.jackrabbit
.server
.io
.ExportContext
;
6 import org
.apache
.jackrabbit
.server
.io
.IOHandler
;
7 import org
.apache
.jackrabbit
.server
.io
.IOManager
;
8 import org
.apache
.jackrabbit
.server
.io
.ImportContext
;
9 import org
.apache
.jackrabbit
.webdav
.DavResource
;
10 import org
.argeo
.ArgeoException
;
12 /** Wraps an IOHandler so that it can be injected a posteriori */
13 public class IOHandlerWrapper
implements IOHandler
{
14 private IOManager ioManager
= null;
15 private IOHandler ioHandler
= null;
17 public void setIOHandler(IOHandler ioHandler
) {
18 if ((this.ioHandler
!= null) && (ioHandler
!= null))
19 throw new ArgeoException(
20 "There is already an IO Handler registered");
21 this.ioHandler
= ioHandler
;
22 if (ioManager
!= null && this.ioHandler
!= null)
23 ioHandler
.setIOManager(ioManager
);
26 public IOHandler
getIOHandler() {
30 public IOManager
getIOManager() {
34 public void setIOManager(IOManager ioManager
) {
35 this.ioManager
= ioManager
;
36 if (ioHandler
!= null)
37 ioHandler
.setIOManager(ioManager
);
40 public String
getName() {
41 if (ioHandler
!= null)
42 return ioHandler
.getName();
44 return "Empty IOHandler Wrapper";
47 public boolean canImport(ImportContext context
, boolean isCollection
) {
48 if (ioHandler
!= null)
49 return ioHandler
.canImport(context
, isCollection
);
53 public boolean canImport(ImportContext context
, DavResource resource
) {
54 if (ioHandler
!= null)
55 return ioHandler
.canImport(context
, resource
);
59 public boolean importContent(ImportContext context
, boolean isCollection
)
61 if (ioHandler
!= null)
62 ioHandler
.importContent(context
, isCollection
);
66 public boolean importContent(ImportContext context
, DavResource resource
)
68 if (ioHandler
!= null)
69 ioHandler
.importContent(context
, resource
);
73 public boolean canExport(ExportContext context
, boolean isCollection
) {
74 if (ioHandler
!= null)
75 ioHandler
.canExport(context
, isCollection
);
79 public boolean canExport(ExportContext context
, DavResource resource
) {
80 if (ioHandler
!= null)
81 ioHandler
.canExport(context
, resource
);
85 public boolean exportContent(ExportContext context
, boolean isCollection
)
87 if (ioHandler
!= null)
88 ioHandler
.exportContent(context
, isCollection
);
92 public boolean exportContent(ExportContext context
, DavResource resource
)
94 if (ioHandler
!= null)
95 ioHandler
.exportContent(context
, resource
);