1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package org.openoffice.xmerge.converter.xml.sxc;
25 
26 import java.io.InputStream;
27 import java.io.IOException;
28 
29 import org.openoffice.xmerge.util.registry.ConverterInfo;
30 import org.openoffice.xmerge.PluginFactory;
31 import org.openoffice.xmerge.Document;
32 import org.openoffice.xmerge.DocumentMergerFactory;
33 
34 
35 /**
36  *  General implementation of the <code>PluginFactory</code> interface
37  *  for SXC <code>Document</code> objects.
38  *
39  *  @see  org.openoffice.xmerge.DocumentDeserializer
40  *  @see  org.openoffice.xmerge.DocumentMerger
41  *  @see  org.openoffice.xmerge.DocumentSerializer
42  */
43 public abstract class SxcPluginFactory
44     extends PluginFactory implements DocumentMergerFactory {
45 
46 
47    /**
48     *  Constructor that caches the <code>ConvertInfo</code> that
49     *  corresponds to the registry information for this plug-in.
50     *
51     *  @param  ci  <code>ConvertInfo</code> object.
52     */
SxcPluginFactory(ConverterInfo ci)53     public SxcPluginFactory(ConverterInfo ci) {
54         super(ci);
55     }
56 
57 
createOfficeDocument(String name, InputStream is)58     public Document createOfficeDocument(String name, InputStream is)
59         throws IOException {
60 
61         // read zipped XML stream
62         //
63         SxcDocument doc = new SxcDocument(name);
64         doc.read(is);
65         return doc;
66     }
67 
createOfficeDocument(String name, InputStream is,boolean isZip)68      public Document createOfficeDocument(String name, InputStream is,boolean isZip)
69         throws IOException {
70 
71         // read zipped XML stream
72         //
73         SxcDocument doc = new SxcDocument(name);
74         doc.read(is,isZip);
75         return doc;
76     }
77 }
78 
79