View Javadoc

1   /*$Id: XmlResults.java,v 1.2 2004/10/18 13:11:30 mch Exp $
2    * Created on 13-Nov-2003
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid
7    * Software License version 1.2, a copy of which has been included
8    * with this distribution in the LICENSE.txt file.
9    *
10  **/
11  package org.astrogrid.datacenter.queriers.xql;
12  
13  import java.io.*;
14  
15  import org.astrogrid.datacenter.queriers.Querier;
16  import org.astrogrid.datacenter.queriers.QueryResults;
17  import org.astrogrid.datacenter.queriers.status.QuerierProcessingResults;
18  import org.astrogrid.io.Piper;
19  
20  /***
21   * A results wrapper around an XML document stream
22   *
23   */
24  public class XmlResults extends QueryResults {
25  
26      protected final InputStream in;
27     
28      /***  Std Constructor. xmlIn is a stream containing the xml document
29       */
30      public XmlResults(Querier querier, InputStream xmlIn) {
31        super(querier);
32        this.in = xmlIn;
33      }
34  
35      /***  Constructor where the xml doc is in the given File
36       */
37      public XmlResults(Querier querier, File xmlFile) throws IOException {
38        super(querier);
39        this.in = new FileInputStream(xmlFile);
40      }
41      
42      public int getCount() {
43         return -1;
44      }
45  
46      /***
47       * Writes out raw - as is
48       */
49      public void writeRaw(Writer out, QuerierProcessingResults querierStatus) throws IOException {
50          Piper.bufferedPipe(new InputStreamReader(in), out);
51      }
52      
53      /***
54       * writes out in Votable
55       */
56      public void writeVotable(Writer out, QuerierProcessingResults querierStatus) throws IOException {
57          throw new UnsupportedOperationException("Not yet implemeneted");
58      }
59      
60      /***
61       * writes out in HTML
62       */
63      public void writeHtml(Writer out, QuerierProcessingResults querierStatus) throws IOException {
64          throw new UnsupportedOperationException("Not yet implemeneted");
65      }
66  
67      /***
68       * writes out in CSV form
69       */
70      public void writeCSV(Writer out, QuerierProcessingResults querierStatus) throws IOException {
71          throw new UnsupportedOperationException("Not yet implemeneted");
72      }
73      
74  }
75  
76  
77  /*
78  $Log: XmlResults.java,v $
79  Revision 1.2  2004/10/18 13:11:30  mch
80  Lumpy Merge
81  
82  Revision 1.1.2.1  2004/10/15 19:59:06  mch
83  Lots of changes during trip to CDS to improve int test pass rate
84  
85  Revision 1.2  2004/09/29 18:43:51  mch
86  doc change
87  
88  Revision 1.1  2004/09/28 15:02:13  mch
89  Merged PAL and server packages
90  
91  Revision 1.1  2004/09/07 00:54:20  mch
92  Tidied up Querier/Plugin/Results, and removed deprecated SPI-visitor-SQL-translator
93  
94  Revision 1.1  2004/09/06 21:37:26  mch
95  Factored out VotableResults
96  
97  Revision 1.3  2004/09/01 12:10:58  mch
98  added results.toHtml
99  
100 Revision 1.2  2004/03/14 03:04:57  mch
101 Added CSV writer
102 
103 Revision 1.1  2004/03/13 23:40:59  mch
104 Changes to adapt to It05 refactor
105 
106 Revision 1.2  2003/12/09 16:25:08  nw
107 wrote plugin documentation
108 
109 Revision 1.1  2003/11/18 11:23:49  nw
110 mavenized cds delegate
111 
112 Revision 1.1  2003/11/18 11:10:05  nw
113 mavenized cds delegate
114  
115 */