00001
00002
00003
00004 #include "Hbase.h"
00005 #include <protocol/TBinaryProtocol.h>
00006 #include <server/TSimpleServer.h>
00007 #include <transport/TServerSocket.h>
00008 #include <transport/TBufferTransports.h>
00009
00010 using namespace ::apache::thrift;
00011 using namespace ::apache::thrift::protocol;
00012 using namespace ::apache::thrift::transport;
00013 using namespace ::apache::thrift::server;
00014
00015 using boost::shared_ptr;
00016
00017 using namespace apache::hadoop::hbase::thrift;
00018
00019 class HbaseHandler : virtual public HbaseIf {
00020 public:
00021 HbaseHandler() {
00022
00023 }
00024
00025 void enableTable(const Bytes& tableName) {
00026
00027 printf("enableTable\n");
00028 }
00029
00030 void disableTable(const Bytes& tableName) {
00031
00032 printf("disableTable\n");
00033 }
00034
00035 bool isTableEnabled(const Bytes& tableName) {
00036
00037 printf("isTableEnabled\n");
00038 }
00039
00040 void compact(const Bytes& tableNameOrRegionName) {
00041
00042 printf("compact\n");
00043 }
00044
00045 void majorCompact(const Bytes& tableNameOrRegionName) {
00046
00047 printf("majorCompact\n");
00048 }
00049
00050 void getTableNames(std::vector<Text> & _return) {
00051
00052 printf("getTableNames\n");
00053 }
00054
00055 void getColumnDescriptors(std::map<Text, ColumnDescriptor> & _return, const Text& tableName) {
00056
00057 printf("getColumnDescriptors\n");
00058 }
00059
00060 void getTableRegions(std::vector<TRegionInfo> & _return, const Text& tableName) {
00061
00062 printf("getTableRegions\n");
00063 }
00064
00065 void createTable(const Text& tableName, const std::vector<ColumnDescriptor> & columnFamilies) {
00066
00067 printf("createTable\n");
00068 }
00069
00070 void deleteTable(const Text& tableName) {
00071
00072 printf("deleteTable\n");
00073 }
00074
00075 void get(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& column) {
00076
00077 printf("get\n");
00078 }
00079
00080 void getVer(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& column, const int32_t numVersions) {
00081
00082 printf("getVer\n");
00083 }
00084
00085 void getVerTs(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& column, const int64_t timestamp, const int32_t numVersions) {
00086
00087 printf("getVerTs\n");
00088 }
00089
00090 void getRow(std::vector<TRowResult> & _return, const Text& tableName, const Text& row) {
00091
00092 printf("getRow\n");
00093 }
00094
00095 void getRowWithColumns(std::vector<TRowResult> & _return, const Text& tableName, const Text& row, const std::vector<Text> & columns) {
00096
00097 printf("getRowWithColumns\n");
00098 }
00099
00100 void getRowTs(std::vector<TRowResult> & _return, const Text& tableName, const Text& row, const int64_t timestamp) {
00101
00102 printf("getRowTs\n");
00103 }
00104
00105 void getRowWithColumnsTs(std::vector<TRowResult> & _return, const Text& tableName, const Text& row, const std::vector<Text> & columns, const int64_t timestamp) {
00106
00107 printf("getRowWithColumnsTs\n");
00108 }
00109
00110 void getRows(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows) {
00111
00112 printf("getRows\n");
00113 }
00114
00115 void getRowsWithColumns(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows, const std::vector<Text> & columns) {
00116
00117 printf("getRowsWithColumns\n");
00118 }
00119
00120 void getRowsTs(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows, const int64_t timestamp) {
00121
00122 printf("getRowsTs\n");
00123 }
00124
00125 void getRowsWithColumnsTs(std::vector<TRowResult> & _return, const Text& tableName, const std::vector<Text> & rows, const std::vector<Text> & columns, const int64_t timestamp) {
00126
00127 printf("getRowsWithColumnsTs\n");
00128 }
00129
00130 void mutateRow(const Text& tableName, const Text& row, const std::vector<Mutation> & mutations) {
00131
00132 printf("mutateRow\n");
00133 }
00134
00135 void mutateRowTs(const Text& tableName, const Text& row, const std::vector<Mutation> & mutations, const int64_t timestamp) {
00136
00137 printf("mutateRowTs\n");
00138 }
00139
00140 void mutateRows(const Text& tableName, const std::vector<BatchMutation> & rowBatches) {
00141
00142 printf("mutateRows\n");
00143 }
00144
00145 void mutateRowsTs(const Text& tableName, const std::vector<BatchMutation> & rowBatches, const int64_t timestamp) {
00146
00147 printf("mutateRowsTs\n");
00148 }
00149
00150 int64_t atomicIncrement(const Text& tableName, const Text& row, const Text& column, const int64_t value) {
00151
00152 printf("atomicIncrement\n");
00153 }
00154
00155 void deleteAll(const Text& tableName, const Text& row, const Text& column) {
00156
00157 printf("deleteAll\n");
00158 }
00159
00160 void deleteAllTs(const Text& tableName, const Text& row, const Text& column, const int64_t timestamp) {
00161
00162 printf("deleteAllTs\n");
00163 }
00164
00165 void deleteAllRow(const Text& tableName, const Text& row) {
00166
00167 printf("deleteAllRow\n");
00168 }
00169
00170 void deleteAllRowTs(const Text& tableName, const Text& row, const int64_t timestamp) {
00171
00172 printf("deleteAllRowTs\n");
00173 }
00174
00175 ScannerID scannerOpenWithScan(const Text& tableName, const TScan& scan) {
00176
00177 printf("scannerOpenWithScan\n");
00178 }
00179
00180 ScannerID scannerOpen(const Text& tableName, const Text& startRow, const std::vector<Text> & columns) {
00181
00182 printf("scannerOpen\n");
00183 }
00184
00185 ScannerID scannerOpenWithStop(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector<Text> & columns) {
00186
00187 printf("scannerOpenWithStop\n");
00188 }
00189
00190 ScannerID scannerOpenWithPrefix(const Text& tableName, const Text& startAndPrefix, const std::vector<Text> & columns) {
00191
00192 printf("scannerOpenWithPrefix\n");
00193 }
00194
00195 ScannerID scannerOpenTs(const Text& tableName, const Text& startRow, const std::vector<Text> & columns, const int64_t timestamp) {
00196
00197 printf("scannerOpenTs\n");
00198 }
00199
00200 ScannerID scannerOpenWithStopTs(const Text& tableName, const Text& startRow, const Text& stopRow, const std::vector<Text> & columns, const int64_t timestamp) {
00201
00202 printf("scannerOpenWithStopTs\n");
00203 }
00204
00205 void scannerGet(std::vector<TRowResult> & _return, const ScannerID id) {
00206
00207 printf("scannerGet\n");
00208 }
00209
00210 void scannerGetList(std::vector<TRowResult> & _return, const ScannerID id, const int32_t nbRows) {
00211
00212 printf("scannerGetList\n");
00213 }
00214
00215 void scannerClose(const ScannerID id) {
00216
00217 printf("scannerClose\n");
00218 }
00219
00220 void getRowOrBefore(std::vector<TCell> & _return, const Text& tableName, const Text& row, const Text& family) {
00221
00222 printf("getRowOrBefore\n");
00223 }
00224
00225 void getRegionInfo(TRegionInfo& _return, const Text& row) {
00226
00227 printf("getRegionInfo\n");
00228 }
00229
00230 };
00231
00232 int main(int argc, char **argv) {
00233 int port = 9090;
00234 shared_ptr<HbaseHandler> handler(new HbaseHandler());
00235 shared_ptr<TProcessor> processor(new HbaseProcessor(handler));
00236 shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
00237 shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
00238 shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
00239
00240 TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
00241 server.serve();
00242 return 0;
00243 }
00244