01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.lib.meta;
20:
21: import java.io.File;
22: import java.io.IOException;
23: import java.io.Writer;
24: import java.util.Map;
25:
26: /**
27: * Interface for meta data serializers.
28: *
29: * @author Abe White
30: * @nojavadoc
31: */
32: public interface MetaDataSerializer {
33:
34: public static final int COMPACT = 0;
35: public static final int PRETTY = 1;
36: public static final int APPEND = 2;
37: public static final int VERBOSE = 4;
38:
39: /**
40: * Serialize the current set of objects to the files from which they were
41: * parsed. Any objects for which a source file cannot be determined will
42: * not be included in the output.
43: *
44: * @param flags bit flags specifying the output flags; e.g. {@link #PRETTY}
45: */
46: public void serialize(int flags) throws IOException;
47:
48: /**
49: * Serialize the current set of objects to the files from which they were
50: * parsed. The objects must implement the {@link SourceTracker} interface.
51: *
52: * @param output if null, then serialize directly to the file system;
53: * othwerwise, populate the specified {@link Map} with
54: * keys that are the {@link File} instances, and
55: * values that are the {@link String} contents of the metadata
56: * @param flags bit flags specifying the output flags; e.g. {@link #PRETTY}
57: */
58: public void serialize(Map output, int flags) throws IOException;
59:
60: /**
61: * Serialize the current set of objects to the given file.
62: *
63: * @param flags bit flags specifying the output flags; e.g.
64: * {@link #PRETTY} | {@link #APPEND}
65: */
66: public void serialize(File file, int flags) throws IOException;
67:
68: /**
69: * Serialize the current set of objects to the given stream.
70: *
71: * @param flags bit flags specifying the output flags; e.g. {@link #PRETTY}
72: */
73: public void serialize(Writer out, int flags) throws IOException;
74: }
|