Skip to content

Commit 9a89bf2

Browse files
committed
Removing external client facing changes.
1 parent 4ed7c00 commit 9a89bf2

27 files changed

Lines changed: 15 additions & 3428 deletions

.rubocop.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,3 @@ Layout/LineLength:
99

1010
Metrics/MethodLength:
1111
Max: 75
12-
13-
GlobalVars:
14-
AllowedVariables:
15-
- $CUST1_ENCODED
16-
- $CUST1_ALIAS
17-
- $CUST1_ENCODED
18-
- $GLOB_CUST_ENCODED
19-
- $TEST
20-
- $TEST_CLUSTER

hbase-client/src/main/java/org/apache/hadoop/hbase/keymeta/KeymetaAdminClient.java

Lines changed: 15 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -19,153 +19,71 @@
1919

2020
import java.io.IOException;
2121
import java.security.KeyException;
22-
import java.util.ArrayList;
2322
import java.util.List;
24-
import org.apache.commons.lang3.NotImplementedException;
2523
import org.apache.hadoop.hbase.client.Connection;
2624
import org.apache.hadoop.hbase.io.crypto.ManagedKeyData;
27-
import org.apache.hadoop.hbase.io.crypto.ManagedKeyState;
2825
import org.apache.yetus.audience.InterfaceAudience;
2926

30-
import org.apache.hbase.thirdparty.com.google.protobuf.ByteString;
31-
import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException;
32-
33-
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
34-
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.BooleanMsg;
35-
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.EmptyMsg;
36-
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.GetManagedKeysResponse;
37-
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ManagedKeyEntryRequest;
38-
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ManagedKeyRequest;
39-
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ManagedKeyResponse;
40-
import org.apache.hadoop.hbase.shaded.protobuf.generated.ManagedKeysProtos;
41-
42-
@InterfaceAudience.Public
27+
/**
28+
* STUB IMPLEMENTATION - Feature not yet complete. This class will be fully implemented in
29+
* HBASE-29368 feature PR.
30+
*/
4331
@InterfaceAudience.Private
4432
public class KeymetaAdminClient implements KeymetaAdmin {
45-
private ManagedKeysProtos.ManagedKeysService.BlockingInterface stub;
4633

4734
public KeymetaAdminClient(Connection conn) throws IOException {
48-
this.stub =
49-
ManagedKeysProtos.ManagedKeysService.newBlockingStub(conn.getAdmin().coprocessorService());
35+
// Stub constructor
5036
}
5137

5238
@Override
5339
public ManagedKeyData enableKeyManagement(byte[] keyCust, String keyNamespace)
54-
throws IOException {
55-
try {
56-
ManagedKeyResponse response = stub.enableKeyManagement(null, ManagedKeyRequest.newBuilder()
57-
.setKeyCust(ByteString.copyFrom(keyCust)).setKeyNamespace(keyNamespace).build());
58-
return generateKeyData(response);
59-
} catch (ServiceException e) {
60-
throw ProtobufUtil.handleRemoteException(e);
61-
}
40+
throws IOException, KeyException {
41+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
6242
}
6343

6444
@Override
6545
public List<ManagedKeyData> getManagedKeys(byte[] keyCust, String keyNamespace)
6646
throws IOException, KeyException {
67-
try {
68-
GetManagedKeysResponse statusResponse =
69-
stub.getManagedKeys(null, ManagedKeyRequest.newBuilder()
70-
.setKeyCust(ByteString.copyFrom(keyCust)).setKeyNamespace(keyNamespace).build());
71-
return generateKeyDataList(statusResponse);
72-
} catch (ServiceException e) {
73-
throw ProtobufUtil.handleRemoteException(e);
74-
}
47+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
7548
}
7649

7750
@Override
7851
public boolean rotateSTK() throws IOException {
79-
try {
80-
BooleanMsg response = stub.rotateSTK(null, EmptyMsg.getDefaultInstance());
81-
return response.getBoolMsg();
82-
} catch (ServiceException e) {
83-
throw ProtobufUtil.handleRemoteException(e);
84-
}
52+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
8553
}
8654

8755
@Override
8856
public void ejectManagedKeyDataCacheEntry(byte[] keyCustodian, String keyNamespace,
8957
String keyMetadata) throws IOException {
90-
throw new NotImplementedException(
91-
"ejectManagedKeyDataCacheEntry not supported in KeymetaAdminClient");
58+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
9259
}
9360

9461
@Override
9562
public void clearManagedKeyDataCache() throws IOException {
96-
throw new NotImplementedException(
97-
"clearManagedKeyDataCache not supported in KeymetaAdminClient");
63+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
9864
}
9965

10066
@Override
10167
public ManagedKeyData disableKeyManagement(byte[] keyCust, String keyNamespace)
10268
throws IOException, KeyException {
103-
try {
104-
ManagedKeyResponse response = stub.disableKeyManagement(null, ManagedKeyRequest.newBuilder()
105-
.setKeyCust(ByteString.copyFrom(keyCust)).setKeyNamespace(keyNamespace).build());
106-
return generateKeyData(response);
107-
} catch (ServiceException e) {
108-
throw ProtobufUtil.handleRemoteException(e);
109-
}
69+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
11070
}
11171

11272
@Override
11373
public ManagedKeyData disableManagedKey(byte[] keyCust, String keyNamespace,
11474
byte[] keyMetadataHash) throws IOException, KeyException {
115-
try {
116-
ManagedKeyResponse response = stub.disableManagedKey(null,
117-
ManagedKeyEntryRequest.newBuilder()
118-
.setKeyCustNs(ManagedKeyRequest.newBuilder().setKeyCust(ByteString.copyFrom(keyCust))
119-
.setKeyNamespace(keyNamespace).build())
120-
.setKeyMetadataHash(ByteString.copyFrom(keyMetadataHash)).build());
121-
return generateKeyData(response);
122-
} catch (ServiceException e) {
123-
throw ProtobufUtil.handleRemoteException(e);
124-
}
75+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
12576
}
12677

12778
@Override
12879
public ManagedKeyData rotateManagedKey(byte[] keyCust, String keyNamespace)
12980
throws IOException, KeyException {
130-
try {
131-
ManagedKeyResponse response = stub.rotateManagedKey(null, ManagedKeyRequest.newBuilder()
132-
.setKeyCust(ByteString.copyFrom(keyCust)).setKeyNamespace(keyNamespace).build());
133-
return generateKeyData(response);
134-
} catch (ServiceException e) {
135-
throw ProtobufUtil.handleRemoteException(e);
136-
}
81+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
13782
}
13883

13984
@Override
14085
public void refreshManagedKeys(byte[] keyCust, String keyNamespace)
14186
throws IOException, KeyException {
142-
try {
143-
stub.refreshManagedKeys(null, ManagedKeyRequest.newBuilder()
144-
.setKeyCust(ByteString.copyFrom(keyCust)).setKeyNamespace(keyNamespace).build());
145-
} catch (ServiceException e) {
146-
throw ProtobufUtil.handleRemoteException(e);
147-
}
148-
}
149-
150-
private static List<ManagedKeyData> generateKeyDataList(GetManagedKeysResponse stateResponse) {
151-
List<ManagedKeyData> keyStates = new ArrayList<>();
152-
for (ManagedKeyResponse state : stateResponse.getStateList()) {
153-
keyStates.add(generateKeyData(state));
154-
}
155-
return keyStates;
156-
}
157-
158-
private static ManagedKeyData generateKeyData(ManagedKeyResponse response) {
159-
// Use hash-only constructor for client-side ManagedKeyData
160-
byte[] keyMetadataHash =
161-
response.hasKeyMetadataHash() ? response.getKeyMetadataHash().toByteArray() : null;
162-
if (keyMetadataHash == null) {
163-
return new ManagedKeyData(response.getKeyCust().toByteArray(), response.getKeyNamespace(),
164-
ManagedKeyState.forValue((byte) response.getKeyState().getNumber()));
165-
} else {
166-
return new ManagedKeyData(response.getKeyCust().toByteArray(), response.getKeyNamespace(),
167-
ManagedKeyState.forValue((byte) response.getKeyState().getNumber()), keyMetadataHash,
168-
response.getRefreshTimestamp());
169-
}
87+
throw new UnsupportedOperationException("KeymetaAdmin feature not yet implemented");
17088
}
17189
}

0 commit comments

Comments
 (0)