sascha@262: package de.intevation.flys.client.server; sascha@262: sascha@276: import org.w3c.dom.Document; sascha@276: import org.w3c.dom.Element; sascha@262: sascha@262: import com.google.gwt.user.server.rpc.RemoteServiceServlet; sascha@262: sascha@276: import de.intevation.artifacts.common.ArtifactNamespaceContext; sascha@276: sascha@276: import de.intevation.artifacts.common.utils.XMLUtils; sascha@276: sascha@262: import de.intevation.flys.client.shared.exceptions.ServerException; sascha@262: sascha@262: import de.intevation.flys.client.client.services.MetaDataService; sascha@262: sascha@276: import de.intevation.artifacts.httpclient.exceptions.ConnectionException; sascha@276: sascha@276: import de.intevation.artifacts.httpclient.http.HttpClient; sascha@276: import de.intevation.artifacts.httpclient.http.HttpClientImpl; sascha@276: sascha@278: import de.intevation.flys.client.shared.model.DataCageTree; sascha@278: sascha@286: import de.intevation.flys.client.server.meta.Converter; sascha@286: sascha@262: public class MetaDataServiceImpl sascha@262: extends RemoteServiceServlet sascha@262: implements MetaDataService sascha@262: { sascha@276: public static final String ERROR_NO_META_DATA_FOUND = sascha@276: "error_no_meta_data_found"; sascha@276: sascha@278: public DataCageTree getMetaData(String url, String locale, String river) sascha@262: throws ServerException sascha@262: { sascha@276: System.out.println("MetaDataService.getDistanceInfo"); sascha@276: sascha@276: Document doc = XMLUtils.newDocument(); sascha@276: sascha@276: XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( sascha@276: doc, sascha@276: ArtifactNamespaceContext.NAMESPACE_URI, sascha@276: ArtifactNamespaceContext.NAMESPACE_PREFIX); sascha@276: sascha@276: Element riverEl = ec.create("river"); sascha@276: sascha@276: riverEl.setTextContent(river); sascha@276: sascha@276: doc.appendChild(riverEl); sascha@276: sascha@276: HttpClient client = new HttpClientImpl(url, locale); sascha@276: sascha@276: try { sascha@286: Converter converter = new Converter(); sascha@286: return converter.convert(client.callService(url, "metadata", doc)); sascha@276: } sascha@276: catch (ConnectionException ce) { sascha@276: System.err.println(ce.getLocalizedMessage()); sascha@276: } sascha@276: sascha@276: throw new ServerException(ERROR_NO_META_DATA_FOUND); sascha@262: } sascha@262: } sascha@262: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :