Search in sources :

Example 96 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolTranslatorPB method createSnapshot.

@Override
public String createSnapshot(String snapshotRoot, String snapshotName) throws IOException {
    final CreateSnapshotRequestProto.Builder builder = CreateSnapshotRequestProto.newBuilder().setSnapshotRoot(snapshotRoot);
    if (snapshotName != null) {
        builder.setSnapshotName(snapshotName);
    }
    final CreateSnapshotRequestProto req = builder.build();
    try {
        return rpcProxy.createSnapshot(null, req).getSnapshotPath();
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : CreateSnapshotRequestProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CreateSnapshotRequestProto) ServiceException(com.google.protobuf.ServiceException)

Example 97 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolTranslatorPB method unsetErasureCodingPolicy.

@Override
public void unsetErasureCodingPolicy(String src) throws IOException {
    final UnsetErasureCodingPolicyRequestProto.Builder builder = ErasureCodingProtos.UnsetErasureCodingPolicyRequestProto.newBuilder();
    builder.setSrc(src);
    UnsetErasureCodingPolicyRequestProto req = builder.build();
    try {
        rpcProxy.unsetErasureCodingPolicy(null, req);
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) UnsetErasureCodingPolicyRequestProto(org.apache.hadoop.hdfs.protocol.proto.ErasureCodingProtos.UnsetErasureCodingPolicyRequestProto)

Example 98 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolTranslatorPB method getEZForPath.

@Override
public EncryptionZone getEZForPath(String src) throws IOException {
    final GetEZForPathRequestProto.Builder builder = GetEZForPathRequestProto.newBuilder();
    builder.setSrc(src);
    final GetEZForPathRequestProto req = builder.build();
    try {
        final EncryptionZonesProtos.GetEZForPathResponseProto response = rpcProxy.getEZForPath(null, req);
        if (response.hasZone()) {
            return PBHelperClient.convert(response.getZone());
        } else {
            return null;
        }
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : GetEZForPathRequestProto(org.apache.hadoop.hdfs.protocol.proto.EncryptionZonesProtos.GetEZForPathRequestProto) ServiceException(com.google.protobuf.ServiceException)

Example 99 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolTranslatorPB method mkdirs.

@Override
public boolean mkdirs(String src, FsPermission masked, boolean createParent) throws IOException {
    MkdirsRequestProto.Builder builder = MkdirsRequestProto.newBuilder().setSrc(src).setMasked(PBHelperClient.convert(masked)).setCreateParent(createParent);
    FsPermission unmasked = masked.getUnmasked();
    if (unmasked != null) {
        builder.setUnmasked(PBHelperClient.convert(unmasked));
    }
    MkdirsRequestProto req = builder.build();
    try {
        return rpcProxy.mkdirs(null, req).getResult();
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : MkdirsRequestProto(org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.MkdirsRequestProto) ServiceException(com.google.protobuf.ServiceException) FsPermission(org.apache.hadoop.fs.permission.FsPermission)

Example 100 with ServiceException

use of com.google.protobuf.ServiceException in project hadoop by apache.

the class ClientNamenodeProtocolTranslatorPB method setAcl.

@Override
public void setAcl(String src, List<AclEntry> aclSpec) throws IOException {
    SetAclRequestProto req = SetAclRequestProto.newBuilder().setSrc(src).addAllAclSpec(PBHelperClient.convertAclEntryProto(aclSpec)).build();
    try {
        if (Client.isAsynchronousMode()) {
            rpcProxy.setAcl(null, req);
            setAsyncReturnValue();
        } else {
            rpcProxy.setAcl(null, req);
        }
    } catch (ServiceException e) {
        throw ProtobufHelper.getRemoteException(e);
    }
}
Also used : SetAclRequestProto(org.apache.hadoop.hdfs.protocol.proto.AclProtos.SetAclRequestProto) ServiceException(com.google.protobuf.ServiceException)

Aggregations

ServiceException (com.google.protobuf.ServiceException)139 IOException (java.io.IOException)66 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)12 Configuration (org.apache.hadoop.conf.Configuration)11 FsPermission (org.apache.hadoop.fs.permission.FsPermission)5 Table (org.apache.hadoop.hbase.client.Table)5 CoprocessorRpcChannel (org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel)5 InetSocketAddress (java.net.InetSocketAddress)4 DatanodeCommand (org.apache.hadoop.hdfs.server.protocol.DatanodeCommand)4 ByteString (com.google.protobuf.ByteString)3 InterruptedIOException (java.io.InterruptedIOException)3 ConnectException (java.net.ConnectException)3 SocketTimeoutException (java.net.SocketTimeoutException)3 Callable (java.util.concurrent.Callable)3 ExecutionException (java.util.concurrent.ExecutionException)3 ExecutorService (java.util.concurrent.ExecutorService)3 EncryptionZone (org.apache.hadoop.hdfs.protocol.EncryptionZone)3 LocatedBlock (org.apache.hadoop.hdfs.protocol.LocatedBlock)3 Server (org.apache.hadoop.ipc.Server)3