1
2
3
4
5
6
7 package org.astrogrid.dataservice.service.cea;
8
9 import java.io.IOException;
10 import org.apache.commons.logging.Log;
11 import org.apache.commons.logging.LogFactory;
12 import org.astrogrid.cfg.ConfigFactory;
13 import org.astrogrid.dataservice.metadata.VoDescriptionServer;
14 import org.astrogrid.dataservice.metadata.VoResourcePlugin;
15 import org.astrogrid.dataservice.metadata.v0_10.VoResourceSupport;
16
17 /***
18 * Serves the CEA resources. Bit of a mangled fudge at the moment to get
19 * the right stuff from the right bit into the right bit.
20 * <p>
21 * @author M Hill
22 */
23
24 public class CeaResources extends VoResourceSupport implements VoResourcePlugin {
25
26 protected static Log log = LogFactory.getLog(VoDescriptionServer.class);
27
28 /***
29 * Returns a CeaServiceType resource element
30 */
31 public String getVoResource() throws IOException {
32 String endpoint =
33 ConfigFactory.getCommonConfig().getString("datacenter.url");
34 if (!endpoint.endsWith("/")) {
35 endpoint = endpoint + "/";
36 }
37 String ceaService =
38 makeVoResourceElement(
39 "cea:CeaServiceType",
40
41 "xmlns:vs='http://www.ivoa.net/xml/VODataService/v0.5' " +
42 "xmlns:cea='http://www.ivoa.net/xml/CEAService/v0.2' ",
43
44 "http://www.ivoa.net/xml/VODataService/v0.5 http://software.astrogrid.org/schema/vo-resource-types/VODataService/v0.5/VODataService.xsd" + " " +
45 "http://www.ivoa.net/xml/CEAService/v0.2 http://software.astrogrid.org/schema/vo-resource-types/CEAService/v0.2/CEAService.xsd"
46 ) +
47 makeCore("ceaService")+
48 "<interface xsi:type='vs:WebService'>"+
49 "<accessURL use='full'>"+ endpoint +
50 "services/CommonExecutionConnectorService"+
51 "</accessURL>"+
52 "</interface>"+
53
54 "<cea:ManagedApplications>"+
55 "<cea:ApplicationReference>"+
56 makeId("ceaApplication")+
57 "</cea:ApplicationReference>"+
58 "</cea:ManagedApplications>"+
59 "</"+VORESOURCE_ELEMENT+">";
60
61
62 String ceaApplication =
63 makeVoResourceElement(
64 "cea:CeaApplicationType",
65
66 "xmlns:cea='http://www.ivoa.net/xml/CEAService/v0.2' " +
67 "xmlns:ceapd='http://www.astrogrid.org/schema/AGParameterDefinition/v1' " +
68 "xmlns:ceab='http://www.astrogrid.org/schema/CommonExecutionArchitectureBase/v1' ",
69
70 "http://www.ivoa.net/xml/CEAService/v0.2 http://software.astrogrid.org/schema/vo-resource-types/CEAService/v0.2/CEAService.xsd" + " " +
71 "http://www.astrogrid.org/schema/AGParameterDefinition/v1 http://software.astrogrid.org/schema/jes/AGParameterDefinition/v1.0/AGParameterDefinition.xsd" + " " +
72 "http://www.astrogrid.org/schema/CommonExecutionArchitectureBase/v1 http://software.astrogrid.org/schema/cea/CommonExecutionArchitectureBase/v1.0/CommonExecutionArchitectureBase.xsd"
73 ) +
74 makeCore("ceaApplication")+
75 "<cea:ApplicationDefinition>\n"+
76 "<cea:Parameters>\n"+
77 "<cea:ParameterDefinition name='Query' type='ADQL'>\n"+
78 "<ceapd:UI_Name>Query</ceapd:UI_Name>\n"+
79 "<ceapd:UI_Description>Astronomy Data Query Language that defines the search criteria</ceapd:UI_Description>\n"+
80
81
82
83 "</cea:ParameterDefinition>\n"+
84 "<cea:ParameterDefinition name='Result' type='text'>\n"+
85 "<ceapd:UI_Name>Result</ceapd:UI_Name>\n"+
86 "<ceapd:UI_Description>Query results</ceapd:UI_Description>\n"+
87 "</cea:ParameterDefinition>\n"+
88 "<cea:ParameterDefinition name='Format' type='text'>\n"+
89 "<ceapd:UI_Name>Format</ceapd:UI_Name>\n"+
90 "<ceapd:UI_Description>How the results are to be returned. VOTABLE or CSV for now</ceapd:UI_Description>\n"+
91 "<ceapd:DefaultValue>VOTABLE</ceapd:DefaultValue>\n"+
92 "</cea:ParameterDefinition>\n"+
93 "<cea:ParameterDefinition name='RA' type='double'>\n"+
94 "<ceapd:UI_Name>RA</ceapd:UI_Name>\n"+
95 "<ceapd:UI_Description>Right-Ascension of cone</ceapd:UI_Description>\n"+
96 "<ceapd:UCD>POS_RA_MAIN</ceapd:UCD>\n"+
97 "<ceapd:Units>deg</ceapd:Units>\n"+
98 "</cea:ParameterDefinition>\n"+
99 "<cea:ParameterDefinition name='DEC' type='double'>\n"+
100 "<ceapd:UI_Name>DEC</ceapd:UI_Name>\n"+
101 "<ceapd:UI_Description>Declination of cone</ceapd:UI_Description>\n"+
102 "<ceapd:UCD>POS_DEC_MAIN</ceapd:UCD>\n"+
103 "<ceapd:Units>deg</ceapd:Units>\n"+
104 "</cea:ParameterDefinition>\n"+
105 "<cea:ParameterDefinition name='Radius' type='double'>\n"+
106 "<ceapd:UI_Name>Radius</ceapd:UI_Name>\n"+
107 "<ceapd:UI_Description>Radius of cone</ceapd:UI_Description>\n"+
108 "<ceapd:Units>deg</ceapd:Units>\n"+
109 "</cea:ParameterDefinition>\n"+
110 "</cea:Parameters>\n"+
111
112 "<cea:Interfaces>\n"+
113 "<ceab:Interface name='adql'>\n"+
114 "<ceab:input>\n"+
115 "<ceab:pref maxoccurs='1' minoccurs='1' ref='Query'/>\n"+
116 "<ceab:pref maxoccurs='1' minoccurs='1' ref='Format'/>\n"+
117 "</ceab:input>\n"+
118 "<ceab:output>\n"+
119 "<ceab:pref maxoccurs='1' minoccurs='1' ref='Result'/>\n"+
120 "</ceab:output>\n"+
121 "</ceab:Interface>\n"+
122 "<ceab:Interface name='cone'>\n"+
123 "<ceab:input>\n"+
124 "<ceab:pref maxoccurs='1' minoccurs='1' ref='RA'/>\n"+
125 "<ceab:pref maxoccurs='1' minoccurs='1' ref='DEC'/>\n"+
126 "<ceab:pref maxoccurs='1' minoccurs='1' ref='Radius'/>\n"+
127 "<ceab:pref maxoccurs='1' minoccurs='1' ref='Format'/>\n"+
128 "</ceab:input>\n"+
129 "<ceab:output>\n"+
130 "<ceab:pref maxoccurs='1' minoccurs='1' ref='Result'/>\n"+
131 "</ceab:output>\n"+
132 "</ceab:Interface>\n"+
133 "</cea:Interfaces>\n"+
134 "</cea:ApplicationDefinition>\n"+
135 "</"+VORESOURCE_ELEMENT+">\n";
136
137
138 return ceaService+ceaApplication;
139 }
140
141 }