All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.client.internal.command.CheckSecurityAuthorization Maven / Gradle / Ivy

package com.alachisoft.ncache.client.internal.command;

import com.alachisoft.ncache.common.protobuf.CacheSecurityAuthorizationCommandProtocol;
import com.alachisoft.ncache.common.protobuf.CommandProtocol;
import com.google.protobuf.ByteString;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

public final class CheckSecurityAuthorization extends Command
{
    private final String _cacheId;
    private final String _userId;
    private final byte[] _password;
    private com.alachisoft.ncache.common.protobuf.CacheSecurityAuthorizationCommandProtocol.CacheSecurityAuthorizationCommand _commandInstance;

    public CheckSecurityAuthorization(String cacheId, String userId, byte[] password)
    {
        super.name = "CacheSecurityAuthorizationCommand";
        super.key = cacheId;
        this._cacheId = cacheId;
        this._userId = userId;
        this._password = password;
    }

    @Override
    protected void createCommand()
    {
        CacheSecurityAuthorizationCommandProtocol.CacheSecurityAuthorizationCommand.Builder builder =
                CacheSecurityAuthorizationCommandProtocol.CacheSecurityAuthorizationCommand.newBuilder();
        builder.setRequestId(super.getRequestId())
                .setCacheId(_cacheId)
                .setUserId(_userId)
                .setPassword(ByteString.copyFrom(_password));

        _commandInstance = builder.build();


    }
    @Override
    public CommandType getCommandType()
    {
        return CommandType.GET_SECURITY_AUTHORIZATION;
    }

    @Override
    public RequestType getCommandRequestType()
    {
        return RequestType.InternalCommand;
    }

    @Override
    protected void serializeCommandInternal(ByteArrayOutputStream stream) throws IOException {
        _commandInstance.writeTo(stream);
    }

    @Override
    protected short getCommandHandle()
    {
        return (short) CommandProtocol.Command.Type.SECURITY_AUTHORIZATION.getNumber();
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy