1 /*
2 * Copyright (c) 2011. The Apache Software Foundation
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package org.apache.hadoop.hbase.hbql.client;
22
23 import java.io.ByteArrayOutputStream;
24 import java.io.PrintStream;
25
26 public class ExecutionResults {
27
28 private final ByteArrayOutputStream baos;
29 public final PrintStream out;
30
31 private boolean success = true;
32 private int count = -1;
33 private boolean predicate = true;
34
35 public ExecutionResults() {
36 this.baos = new ByteArrayOutputStream();
37 this.out = new PrintStream(baos);
38 }
39
40 public ExecutionResults(final String str) {
41 this();
42 this.out.println(str);
43 }
44
45 public boolean hadSuccess() {
46 return this.success;
47 }
48
49 public void setSuccess(final boolean success) {
50 this.success = success;
51 }
52
53 public String toString() {
54 this.out.flush();
55 return baos.toString();
56 }
57
58 public int getCount() {
59 return this.count;
60 }
61
62 public void setCount(final int count) {
63 this.count = count;
64 }
65
66 public boolean getPredicate() {
67 return this.predicate;
68 }
69
70 public void setPredicate(final boolean predicate) {
71 this.predicate = predicate;
72 }
73 }