]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/ServerAnswer.java
Update license headers
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.core / src / main / java / org / argeo / server / ServerAnswer.java
index c3e747608dcf10fc264ca87ecbdc4127c5829482..19f032143b1622c5e9f804610f8d61235c44e167 100644 (file)
@@ -1,9 +1,25 @@
+/*
+ * 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 {
@@ -13,11 +29,13 @@ 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;
        }
 
@@ -31,7 +49,7 @@ public class ServerAnswer {
 
        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;
        }
 
@@ -69,4 +87,9 @@ public class ServerAnswer {
                return new ServerAnswer(OK, message);
        }
 
+       @Override
+       public String toString() {
+               return "ServerAnswer{status:" + status + ", message:" + message + "}";
+       }
+
 }