View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3   
4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
5   
6    This library is free software; you can redistribute it and/or modify it under
7    the terms of the GNU Lesser General Public License as published by the Free
8    Software Foundation; either version 2.1 of the License, or (at your option)
9    any later version.
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13   details.
14   You should have received a copy of the GNU Lesser General Public License along
15   with this library; if not, write to the Free Software Foundation, Inc.,
16   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17   */
18  
19  package com.ontotext.wsmo4j.serializer.wsml;
20  
21  /**
22   * <p>Title: WSMO4J</p>
23   * <p>Description: WSMO API and a Reference Implementation</p>
24   * <p>Copyright:  Copyright (c) 2004-2005</p>
25   * <p>Company: OntoText Lab. / SIRMA </p>
26   * @author not attributable
27   * @version 1.0
28   *
29   */
30  
31  import java.io.IOException;
32  import java.io.StringWriter;
33  import java.io.Writer;
34  import java.util.Map;
35  
36  import org.wsmo.common.TopEntity;
37  import org.wsmo.wsml.Serializer;
38  
39  public class WSMLSerializerImpl implements Serializer {
40  
41      public WSMLSerializerImpl(Map <String, Object> props) {
42  
43      }
44  
45      public void serialize(TopEntity[] item, StringBuffer writer) {
46          StringWriter wrt = new StringWriter();
47          try {
48              serialize(item, wrt);
49              writer.append(wrt.getBuffer());
50          }
51          catch (IOException ioe) {
52              throw new RuntimeException("cannot write due to an exception:", ioe);
53          }
54      }
55  
56      public void serialize(TopEntity[] item, StringBuffer writer, Map options) {
57          throw new UnsupportedOperationException("Unimplemented method serialize(TopEntity, StringBuffer, Map)");
58      }
59     
60      
61      public void serialize(TopEntity[] topItem, Writer writer) throws IOException {
62          //quick hack, since WSMLTextExportHelper expects an array
63          new WSMLTextExportHelper(writer).process(topItem);
64      }
65  
66      public void serialize(TopEntity[] item, Writer writer, Map options) {
67          throw new UnsupportedOperationException("Unimplemented method serialize(TopEntity, Writer, Map)");
68      }
69  
70  
71  }