| 1 | /******************************************************************** |
| 2 | * Copyright (c) 2013 - 2014, Pivotal Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Author: Zhanwei Wang |
| 6 | ********************************************************************/ |
| 7 | /******************************************************************** |
| 8 | * 2014 - |
| 9 | * open source under Apache License Version 2.0 |
| 10 | ********************************************************************/ |
| 11 | /** |
| 12 | * Licensed to the Apache Software Foundation (ASF) under one |
| 13 | * or more contributor license agreements. See the NOTICE file |
| 14 | * distributed with this work for additional information |
| 15 | * regarding copyright ownership. The ASF licenses this file |
| 16 | * to you under the Apache License, Version 2.0 (the |
| 17 | * "License"); you may not use this file except in compliance |
| 18 | * with the License. You may obtain a copy of the License at |
| 19 | * |
| 20 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 21 | * |
| 22 | * Unless required by applicable law or agreed to in writing, software |
| 23 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 25 | * See the License for the specific language governing permissions and |
| 26 | * limitations under the License. |
| 27 | */ |
| 28 | #ifndef _HDFS_LIBHDFS3_CLIENT_TOKEN_H_ |
| 29 | #define _HDFS_LIBHDFS3_CLIENT_TOKEN_H_ |
| 30 | |
| 31 | #include <string> |
| 32 | |
| 33 | namespace Hdfs { |
| 34 | namespace Internal { |
| 35 | |
| 36 | class Token { |
| 37 | public: |
| 38 | const std::string & getIdentifier() const { |
| 39 | return identifier; |
| 40 | } |
| 41 | |
| 42 | void setIdentifier(const std::string & identifier) { |
| 43 | this->identifier = identifier; |
| 44 | } |
| 45 | |
| 46 | const std::string & getKind() const { |
| 47 | return kind; |
| 48 | } |
| 49 | |
| 50 | void setKind(const std::string & kind) { |
| 51 | this->kind = kind; |
| 52 | } |
| 53 | |
| 54 | const std::string & getPassword() const { |
| 55 | return password; |
| 56 | } |
| 57 | |
| 58 | void setPassword(const std::string & password) { |
| 59 | this->password = password; |
| 60 | } |
| 61 | |
| 62 | const std::string & getService() const { |
| 63 | return service; |
| 64 | } |
| 65 | |
| 66 | void setService(const std::string & service) { |
| 67 | this->service = service; |
| 68 | } |
| 69 | |
| 70 | bool operator ==(const Token & other) const { |
| 71 | return identifier == other.identifier && password == other.password |
| 72 | && kind == other.kind && service == other.service; |
| 73 | } |
| 74 | |
| 75 | std::string toString() const; |
| 76 | |
| 77 | Token & fromString(const std::string & str); |
| 78 | |
| 79 | size_t hash_value() const; |
| 80 | |
| 81 | private: |
| 82 | std::string identifier; |
| 83 | std::string password; |
| 84 | std::string kind; |
| 85 | std::string service; |
| 86 | }; |
| 87 | |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | #endif /* _HDFS_LIBHDFS3_CLIENT_TOKEN_H_ */ |
| 92 | |