01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.
15: */
16: package org.outerj.daisy.repository.spi.local;
17:
18: import org.outerj.daisy.repository.Document;
19: import org.outerj.daisy.repository.Repository;
20:
21: /**
22: * A pre-save hook is executed after the repository user requested to
23: * save the document, but before the document is actually saved.
24: *
25: * <p>This hook can modify the content of the document before saving.
26: * For example, to extract information from images or other types
27: * of documents and assign it to parts or fields.
28: *
29: * <p>The PreSaveHook should be registered as a plugin with the
30: * {@link org.outerj.daisy.plugin.PluginRegistry PluginRegistry}
31: */
32: public interface PreSaveHook {
33: /**
34: * Performs the pre-save work by modifying the supplied Document object.
35: *
36: * <p>If this method throws an exception, it will be logged, but the
37: * document will still be saved. Hence, a pre-save hook cannot prevent
38: * a document from being saved.
39: */
40: void process(Document document, Repository repository)
41: throws Exception;
42: }
|