1 package org.astrogrid.registry.client.query;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5
6 import java.net.URL;
7 import java.util.Vector;
8 import javax.xml.parsers.DocumentBuilder;
9 import javax.xml.parsers.DocumentBuilderFactory;
10 import javax.xml.parsers.ParserConfigurationException;
11 import java.io.IOException;
12 import org.apache.axis.client.Call;
13 import org.apache.axis.client.Service;
14 import org.apache.axis.message.SOAPBodyElement;
15 import org.apache.axis.utils.XMLUtils;
16 import org.w3c.dom.Document;
17 import org.w3c.dom.NodeList;
18 import org.w3c.dom.Node;
19 import org.w3c.dom.Element;
20 import java.io.Reader;
21 import java.io.StringReader;
22 import org.xml.sax.InputSource;
23 import java.text.SimpleDateFormat;
24 import java.util.HashMap;
25 import java.util.Map;
26 import java.util.Set;
27 import java.util.Calendar;
28 import java.util.List;
29 import java.util.Iterator;
30 import java.util.Date;
31
32 import org.astrogrid.registry.RegistryException;
33 import org.astrogrid.registry.common.InterfaceType;
34 import org.astrogrid.registry.common.XSLHelper;
35
36 import javax.xml.namespace.QName;
37 import javax.xml.rpc.ServiceException;
38 import javax.wsdl.xml.WSDLReader;
39 import javax.wsdl.*;
40 import javax.wsdl.extensions.ExtensibilityElement;
41 import javax.wsdl.extensions.soap.SOAPAddress;
42
43 import org.xml.sax.SAXException;
44 import java.rmi.RemoteException;
45
46 import org.astrogrid.registry.common.WSDLBasicInformation;
47
48 import javax.wsdl.factory.WSDLFactory;
49
50 import org.astrogrid.config.Config;
51 import org.astrogrid.store.Ivorn;
52 import org.astrogrid.util.DomHelper;
53
54
55 /***
56 *
57 * Class: RegistryService
58 * Type: Interface
59 * Description: A interface used to be given to clients from the Delegate Factory for querying the registry.
60 * Essentially this is the interface to the delegate. See QueryRegistry for the implemented class of this
61 * interface.
62 *
63 * @see org.astrogrid.registry.client.query.QueryRegistry
64 *
65 * @link http://www.ivoa.net/twiki/bin/view/IVOA/IVOARegWp03
66 * @author Kevin Benson
67 */
68 public interface RegistryService {
69
70 /***
71 * Method: getRegistries
72 * Description: client inteface method to call web service method for obtaining all the registr types.
73 * @return XML Document of all the Registry type Resources known.
74 * @throws RegistryException
75 */
76 public Document getRegistries() throws RegistryException;
77
78 /***
79 * Method: search
80 * Description: client inteface method to call web service method search(Document).
81 * @param xadql XML string of ADQL to be parsed into a Document object.
82 * @return XML Document of all the Resources in the registry constrained by the adql query.
83 * @throws RegistryException
84 */
85 public Document search(String xadql) throws RegistryException;
86
87 /***
88 * Method: search
89 * Description: client inteface method to call web service method for querying the registry in ADQL.
90 * @param adql the adql:where is passed to the web service call. It can be any form of adql.
91 * @return XML Document of all the Resources in the registry constrained by the adql query.
92 * @throws RegistryException
93 */
94 public Document search(Document adql) throws RegistryException;
95
96 /***
97 * Method: searchFromSADQL
98 * Description: client inteface method to call web service method search(Document).
99 * @param xadql SQL type string to be parsed into the current ADQL XML DOM.
100 * @return XML Document of all the Resources in the registry constrained by the adql query.
101 * @throws RegistryException
102 */
103 public Document searchFromSADQL(String sadql) throws RegistryException;
104
105 /***
106 * Method: submitQuery
107 * Description: client inteface method to call web service method submitQuery(Document). This is an old style xml
108 * query language that Astrogrid had. Soon to be deprecated and no longer used.
109 * @param query Old style xml string to be converted to XML Document object.
110 * @return XML Document of all the Resources in the registry constrained by the query.
111 * @throws RegistryException
112 */
113 public Document submitQuery(String query) throws RegistryException;
114
115 /***
116 * Method: submitQuery
117 * Description: client inteface method to call web service method. This is an old style xml
118 * query language that Astrogrid had. Soon to be deprecated and no longer used.
119 * @param query XML Document object in an old style query xml language from astrogrid.
120 * @return XML Document of all the Resources in the registry constrained by the query.
121 * @throws RegistryException
122 */
123 public Document submitQuery(Document query) throws RegistryException;
124
125 public Document loadRegistry() throws RegistryException;
126
127 public HashMap managedAuthorities() throws RegistryException;
128
129 /***
130 * Method: getResourceByIdentifier
131 * Description: client inteface method to call web service method getResourceByIdentifier(String).
132 * Grabs Resource(s)
133 * (normally 1 Resource), from a particular identifier (the primary key in a sense). Identifier is
134 * made up of a authroityID+ResourceKey. Normally most clients pass both of these in returning only 1
135 * XML Resource hence name is getResoruce. Recently you may pass in just a AuthorityID allowing you to
136 * get multiple Resources back.
137 * @param ident Ivorn object which is a ivo://authorityid+ResourceKey.
138 * @return XML Document of all the Resources in the registry constrained by the query.
139 * @throws RegistryException
140 */
141 public Document getResourceByIdentifier(Ivorn ident) throws RegistryException;
142
143 /***
144 * Method: getResourceByIdentifier
145 * Description: client inteface method to call web service method getResourceByIdentifier(Document).
146 * Grabs Resource(s)
147 * (normally 1 Resource), from a particular identifier (the primary key in a sense). Identifier is
148 * made up of a authroityID+ResourceKey. Normally most clients pass both of these in returning only 1
149 * XML Resource hence name is getResoruce. Recently you may pass in just a AuthorityID allowing you to
150 * get multiple Resources back.
151 * @param ident String object which is a ivo://authorityid+ResourceKey.
152 * @return XML Document of all the Resources in the registry constrained by the query.
153 * @throws RegistryException
154 */
155 public Document getResourceByIdentifier(String ident) throws RegistryException;
156
157 public ServiceData[] getResourcesByInterfaceType(InterfaceType interfaceType) throws RegistryException;
158
159 /***
160 * Method: getEndPointByIdentifier
161 * Description: client inteface method to call web service method getResourceByIdentifier(String).
162 * Grabs a URL from the Interface XML element.
163 * @param ident Ivorn object which is a ivo://authorityid+ResourceKey.
164 * @return String version of a URL from the Interface Element in a XML Resource.
165 * @throws RegistryException
166 */
167 public String getEndPointByIdentifier(Ivorn ident) throws RegistryException;
168
169 /***
170 * Method: getEndPointByIdentifier
171 * Description: client inteface method to call web service method getResourceByIdentifier(String).
172 * Grabs a URL from the Interface XML element.
173 * @param ident Ivorn object which is a ivo://authorityid+ResourceKey.
174 * @return String version of a URL from the Interface Element in a XML Resource.
175 * @throws RegistryException
176 */
177 public String getEndPointByIdentifier(String ident) throws RegistryException;
178
179 public URL[] getEndPointByInterfaceType(InterfaceType interfaceType) throws RegistryException;
180
181 public Document identify() throws RegistryException;
182
183 public Document listRecords() throws RegistryException;
184
185 public Document listRecords(Date fromDate) throws RegistryException;
186
187 public Document listRecords(String metadataPrefix, Date fromDate, Date untilDate) throws RegistryException;
188
189 public Document listMetadataFormats(String identifier) throws RegistryException;
190
191 public Document getRecord(String identifier) throws RegistryException;
192
193 public Document getRecord(String identifier, String metadataPrefix) throws RegistryException;
194
195 public Document listIdentifiers() throws RegistryException;
196
197 public Document listIdentifiers(String metadataPrefix, Date fromDate, Date untilDate) throws RegistryException;
198
199
200 }