View Javadoc

1   /*
2    * $Id: VoTableFitsWriter.java,v 1.5 2006/10/17 10:11:41 clq2 Exp $
3    *
4    * (C) Copyright Astrogrid...
5    */
6   
7   package org.astrogrid.tableserver.out;
8   
9   import java.io.IOException;
10  import java.security.Principal;
11  import org.astrogrid.slinger.targets.TargetIdentifier;
12  import org.astrogrid.tableserver.metadata.ColumnInfo;
13  
14  /***
15   * For writing out fits wrapped in votable
16   *
17   * @author M Hill
18   */
19  
20  public class VoTableFitsWriter extends VoTableWriter {
21     
22     
23     /***
24      * Construct this wrapping the given stream.  Writes out the first few tags
25      */
26     public VoTableFitsWriter(TargetIdentifier target, String title, Principal user) throws IOException {
27        super(target, title, user);
28     }
29     
30     /*** Opens writer - starts the document with appropriate headers */
31     public void open() {
32        printOut.println("<?xml version='1.0' encoding='UTF-8'?>");
33              // The current astrogrid/xml validator wants this next
34              // line, but then falls over at the xmlns:xsi stuff.  
35              // printOut.println("<!DOCTYPE VOTABLE SYSTEM \"http://us-vo.org/xml/VOTable.dtd\">");
36               printOut.println("<VOTABLE "
37                  +"xmlns='http://www.ivoa.net/xml/VOTable/v1.1'  "
38                  +"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'  "
39                  +"xsi:schemaLocation='http://www.ivoa.net/xml/VOTable/v1.1 http://software.astrogrid.org/schema/vo-formats/VOTable/v1.1/VOTable.xsd'  "
40                  +"version='1.1'"                                                                +">");
41     }
42     
43     /*** Start body - writes out header and preps col array */
44     public void startTable(ColumnInfo[] cols) throws IOException {
45     }
46     
47     /*** Actually writes out a table.  Assumes only 1 element in given colValues,
48      * that element being the fits url */
49     public void writeRow(Object[] colValues) throws IOException {
50        
51        printOut.println("<TABLE>");
52        printOut.println("<DATA><FITS>");
53        
54        printOut.println("   <STREAM href='"+colValues[0]+"' />");
55        
56        printOut.println("</FITS></DATA>");
57        printOut.println("</TABLE>");
58        
59     }
60     
61     public void endTable() {
62        
63     }
64     public void close() {
65        printOut.println("</VOTABLE>");
66        printOut.close();
67     }
68  }
69  
70  /*
71   $Log: VoTableFitsWriter.java,v $
72   Revision 1.5  2006/10/17 10:11:41  clq2
73   PAL_KEA_1869
74  
75   Revision 1.4.48.1  2006/10/12 16:40:15  kea
76   Tweaks while fixing registration issues (see bugzilla ticket 1920)
77  
78   Revision 1.4  2005/11/21 12:54:18  clq2
79   DSA_KEA_1451
80  
81   Revision 1.3.38.1  2005/11/15 15:37:28  kea
82   Fixed open() and close() methods so as to produce valid VOTable.
83  
84   Revision 1.3  2005/05/27 16:21:02  clq2
85   mchv_1
86  
87   Revision 1.2.10.2  2005/05/13 16:56:32  mch
88   'some changes'
89  
90   Revision 1.2.10.1  2005/04/21 17:20:51  mch
91   Fixes to output types
92  
93   Revision 1.2  2005/03/30 21:51:25  mch
94   Fix to return Votable fits list for url list
95  
96   Revision 1.1  2005/03/21 18:45:55  mch
97   Naughty big lump of changes
98  
99   Revision 1.3  2005/03/10 15:13:48  mch
100  Seperating out fits, table and xdb servers
101 
102  Revision 1.2  2005/03/10 13:49:52  mch
103  Updating metadata
104 
105  Revision 1.1.1.1  2005/02/17 18:37:34  mch
106  Initial checkin
107 
108  Revision 1.1.1.1  2005/02/16 17:11:24  mch
109  Initial checkin
110 
111  Revision 1.1.2.3  2005/01/13 18:57:31  mch
112  Fixes to metadata mostly
113 
114  Revision 1.1.2.2  2004/12/08 18:36:40  mch
115  Added Vizier, rationalised SqlWriters etc, separated out TableResults from QueryResults
116 
117  Revision 1.1.2.1  2004/11/30 01:26:42  mch
118  added tablewriters
119 
120 
121 
122  */