]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/jackrabbit/remote/IOHandlerWrapper.java
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.jackrabbit
.remote
;
18 import java
.io
.IOException
;
20 import org
.apache
.jackrabbit
.server
.io
.ExportContext
;
21 import org
.apache
.jackrabbit
.server
.io
.IOHandler
;
22 import org
.apache
.jackrabbit
.server
.io
.IOManager
;
23 import org
.apache
.jackrabbit
.server
.io
.ImportContext
;
24 import org
.apache
.jackrabbit
.webdav
.DavResource
;
25 import org
.argeo
.ArgeoException
;
27 /** Wraps an IOHandler so that it can be injected a posteriori */
28 public class IOHandlerWrapper
implements IOHandler
{
29 private IOManager ioManager
= null;
30 private IOHandler ioHandler
= null;
32 public void setIOHandler(IOHandler ioHandler
) {
33 if ((this.ioHandler
!= null) && (ioHandler
!= null))
34 throw new ArgeoException(
35 "There is already an IO Handler registered");
36 this.ioHandler
= ioHandler
;
37 if (ioManager
!= null && this.ioHandler
!= null)
38 ioHandler
.setIOManager(ioManager
);
41 public IOHandler
getIOHandler() {
45 public IOManager
getIOManager() {
49 public void setIOManager(IOManager ioManager
) {
50 this.ioManager
= ioManager
;
51 if (ioHandler
!= null)
52 ioHandler
.setIOManager(ioManager
);
55 public String
getName() {
56 if (ioHandler
!= null)
57 return ioHandler
.getName();
59 return "Empty IOHandler Wrapper";
62 public boolean canImport(ImportContext context
, boolean isCollection
) {
63 if (ioHandler
!= null)
64 return ioHandler
.canImport(context
, isCollection
);
68 public boolean canImport(ImportContext context
, DavResource resource
) {
69 if (ioHandler
!= null)
70 return ioHandler
.canImport(context
, resource
);
74 public boolean importContent(ImportContext context
, boolean isCollection
)
76 if (ioHandler
!= null)
77 ioHandler
.importContent(context
, isCollection
);
81 public boolean importContent(ImportContext context
, DavResource resource
)
83 if (ioHandler
!= null)
84 ioHandler
.importContent(context
, resource
);
88 public boolean canExport(ExportContext context
, boolean isCollection
) {
89 if (ioHandler
!= null)
90 ioHandler
.canExport(context
, isCollection
);
94 public boolean canExport(ExportContext context
, DavResource resource
) {
95 if (ioHandler
!= null)
96 ioHandler
.canExport(context
, resource
);
100 public boolean exportContent(ExportContext context
, boolean isCollection
)
102 if (ioHandler
!= null)
103 ioHandler
.exportContent(context
, isCollection
);
107 public boolean exportContent(ExportContext context
, DavResource resource
)
109 if (ioHandler
!= null)
110 ioHandler
.exportContent(context
, resource
);