KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > xmi > XMIWriter


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.api.xmi;
20
21 import java.util.Collection JavaDoc;
22 import java.io.OutputStream JavaDoc;
23 import java.io.IOException JavaDoc;
24 import javax.jmi.reflect.RefPackage;
25 import javax.jmi.xmi.XmiWriter;
26
27 /** Base class for enhanced XMI writers.
28  *
29  * @author Martin Matula
30  * @author Brian Smith
31  */

32 public abstract class XMIWriter implements XmiWriter {
33     //----------------
34
// public methods
35
//----------------
36

37     /** Returns configuration object of this XMIWriter. Any changes to the returned
38      * object will have immediate effect on the XMIWriter's configuration.
39      */

40     public abstract XMIOutputConfig getConfiguration();
41     
42     /** Writes specified objects and a transitive closure of their components to
43      * an XMI document using the specified output stream and URI.
44      * @param stream Output stream that should be used for XMI document generation.
45      * If <code>null</code>, XMIWriter will try to create a new output stream using
46      * the specified URI.
47      * @param uri Target URI of the document. When set to <code>null</code>,
48      * any XMIReferenceProvider registered will be ignored as XMIWriter is not able
49      * to determine whether the returned reference points to the same file.
50      * @param objects Collection of objects to be serialized into XMI (objects
51      * will be serialized recursively including their components).
52      * @param xmiVersion Version of XMI to be used for writing.
53      * @throws IOException Error during XMI production.
54      */

55     public abstract void write(OutputStream JavaDoc stream, String JavaDoc uri, Collection JavaDoc objects, String JavaDoc xmiVersion) throws IOException JavaDoc;
56
57     /** Writes content of the specified package extent to
58      * an XMI document using the specified output stream and URI.
59      * @param stream Output stream that should be used for XMI document generation.
60      * If <code>null</code>, XMIWriter will try to create a new output stream using
61      * the specified URI.
62      * @param uri Target URI of the document. When set to <code>null</code>,
63      * any XMIReferenceProvider registered will be ignored as XMIWriter is not able
64      * to determine whether the returned reference points to the same file.
65      * @param extent Package extent to be serialized into XMI.
66      * @param xmiVersion Version of XMI to be used for writing.
67      * @throws IOException Error during XMI production.
68      */

69     public abstract void write(OutputStream JavaDoc stream, String JavaDoc uri, RefPackage extent, String JavaDoc xmiVersion) throws IOException JavaDoc;
70
71     
72     //-------------------------------------------
73
// javax.jmi.xmi.XmiWriter interface methods
74
//-------------------------------------------
75

76     /** Standard JMI method for writing content of a package extent into an XMI document.
77      * @param stream Output stream to be used for writing the XMI document.
78      * @param extent Package extent to be serialized into XMI document.
79      * @param xmiVersion Version of XMI to be produced.
80      * @throws IOException Error occurred during the production of XMI document.
81      */

82     public void write(OutputStream JavaDoc stream, RefPackage extent, String JavaDoc xmiVersion) throws IOException JavaDoc {
83         write(stream, null, extent, xmiVersion);
84     }
85     
86     /** Standard JMI method for writing collection of objects (and transitive
87      * closure of their components) an XMI document.
88      * @param stream Output stream to be used for writing the XMI document.
89      * @param objects Objects to be serialized into XMI document.
90      * @param xmiVersion Version of XMI to be produced.
91      * @throws IOException Error occurred during the production of XMI document.
92      */

93     public void write(OutputStream JavaDoc stream, Collection JavaDoc objects, String JavaDoc xmiVersion) throws IOException JavaDoc {
94         write(stream, null, objects, xmiVersion);
95     }
96 }
97
Popular Tags