view flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java @ 14:fe2f4d1dd784

Integrated the httpclient for the communication between client and server. It is now possible to create a new WINFO artifact. flys-client/trunk@1326 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 17 Feb 2011 11:52:55 +0000
parents 6aeb4072eeb4
children e02f50a3ad59
line wrap: on
line source
package de.intevation.flys.client.server;

import org.w3c.dom.Document;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import de.intevation.artifacts.common.utils.ClientProtocolUtils;

import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
import de.intevation.artifacts.httpclient.http.HttpClient;
import de.intevation.artifacts.httpclient.http.HttpClientImpl;

import de.intevation.flys.client.shared.model.Artifact;
import de.intevation.flys.client.client.services.ArtifactService;


/**
 * This interface provides artifact specific services as CREATE, DESCRIBE, FEED,
 * ADVANCE and OUT.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class ArtifactServiceImpl
extends      RemoteServiceServlet
implements   ArtifactService
{
    public Artifact create(String serverUrl, String factory) {
        Document create   = ClientProtocolUtils.newCreateDocument(factory);
        HttpClient client = new HttpClientImpl(serverUrl);

        try {
            return (Artifact) client.create(create, new FLYSArtifactCreator());
        }
        catch (ConnectionException ce) {
            System.err.println(ce.getLocalizedMessage());
        }

        return null;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org