01: /*
02: * Copyright (C) 1999-2005 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package org.mandarax.zkb;
20:
21: import org.mandarax.util.logging.LogCategories;
22: import java.util.Properties;
23:
24: /**
25: * Interface that describes how ZKB is imported / exported.
26: * This functionality used to be in the ZKBManager (v3.3 and older), outsourcing it has various advantages, in
27: * particular that we can now export/import to/from zip files AND folders.
28: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
29: * @version 3.4 <7 March 05>
30: * @since 3.4
31: */
32:
33: public interface IOManager extends LogCategories {
34:
35: // constant
36: public static final String META = "zkb-meta-inf.properties";
37: public static final String KB = "kb.xml";
38: public static final String RESOURCES = "resources"; // + extension from ops used (e.g. .ser or .xml)
39:
40: // return type for read method
41: public class Data {
42: public Properties metaData = null;
43: public byte[] kbData, resourceData;
44: public ObjectPersistencyService ops;
45: }
46:
47: /**
48: * Write zkb data.
49: * @param target an object describing the target (e.g. a file)
50: * @param metaData the serialized meta data
51: * @param kbData the serialized knowledge base
52: * @param resourceData the serialized resource data (objects)
53: * @param ops the object persistency service used
54: */
55: public void write(Object target, byte[] metaData, byte[] kbData,
56: byte[] resourceData, ObjectPersistencyService ops)
57: throws Exception;
58:
59: /**
60: * Read zkb data.
61: * @param source the data source (e.g., a file)
62: * @return a data object
63: */
64: public Data read(Object source) throws Exception;
65: }
|