+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.argeo.server;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.apache.commons.io.IOUtils;
+import org.argeo.ArgeoException;
/** Answer to an execution of a remote service which performed changes. */
public class ServerAnswer {
private String status = OK;
private String message = "";
+ // TODO: add an exception field
+
/** Canonical constructor */
public ServerAnswer(String status, String message) {
setStatus(status);
if (message == null)
- throw new ArgeoServerException("Message cannot be null");
+ throw new ArgeoException("Message cannot be null");
this.message = message;
}
public void setStatus(String status) {
if (status == null || (!status.equals(OK) && !status.equals(ERROR)))
- throw new ArgeoServerException("Bad status format: " + status);
+ throw new ArgeoException("Bad status format: " + status);
this.status = status;
}
@Override
public String toString() {
- return "ServerAnswer{status:"+status+", message:"+message+"}";
+ return "ServerAnswer{status:" + status + ", message:" + message + "}";
}
}