ingo@11: package de.intevation.flys.client.server; ingo@11: ingo@11: import org.w3c.dom.Document; ingo@11: ingo@11: import com.google.gwt.user.server.rpc.RemoteServiceServlet; ingo@11: ingo@14: import de.intevation.artifacts.common.utils.ClientProtocolUtils; ingo@11: ingo@14: import de.intevation.artifacts.httpclient.exceptions.ConnectionException; ingo@14: import de.intevation.artifacts.httpclient.http.HttpClient; ingo@14: import de.intevation.artifacts.httpclient.http.HttpClientImpl; ingo@11: ingo@215: import de.intevation.flys.client.shared.exceptions.ServerException; ingo@11: import de.intevation.flys.client.shared.model.Artifact; ingo@11: import de.intevation.flys.client.client.services.ArtifactService; ingo@11: ingo@11: ingo@11: /** ingo@11: * This interface provides artifact specific services as CREATE, DESCRIBE, FEED, ingo@11: * ADVANCE and OUT. ingo@11: * ingo@11: * @author Ingo Weinzierl ingo@11: */ ingo@11: public class ArtifactServiceImpl ingo@11: extends RemoteServiceServlet ingo@11: implements ArtifactService ingo@11: { ingo@215: /** The error message key that is thrown if an error occured while artifact ingo@215: * creation.*/ ingo@215: public static final String ERROR_CREATE_ARTIFACT = "error_create_artifact"; ingo@215: ingo@215: ingo@229: public Artifact create(String serverUrl, String locale, String factory) ingo@215: throws ServerException ingo@215: { ingo@229: System.out.println("ArtifactServiceImpl.create"); ingo@229: ingo@14: Document create = ClientProtocolUtils.newCreateDocument(factory); ingo@229: HttpClient client = new HttpClientImpl(serverUrl, locale); ingo@11: ingo@14: try { ingo@14: return (Artifact) client.create(create, new FLYSArtifactCreator()); ingo@14: } ingo@14: catch (ConnectionException ce) { ingo@14: System.err.println(ce.getLocalizedMessage()); ingo@14: } ingo@14: ingo@215: throw new ServerException(ERROR_CREATE_ARTIFACT); ingo@11: } ingo@11: } ingo@11: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :