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

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

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

import com.alachisoft.ncache.common.protobuf.CommandProtocol;
import com.alachisoft.ncache.common.protobuf.GetCacheManagementPortCommandProtocol;
import com.alachisoft.ncache.runtime.exceptions.CommandException;
import com.google.protobuf.ByteString;

import java.io.IOException;

public class GetCacheHostPortCommand extends InitialCommandBase {

    private final String cacheid;
    private ByteString userName;
    private ByteString password;

    public GetCacheHostPortCommand(String id, byte[] userName, byte[] password) {
        name = "GetCacheManagementPort";
        this.cacheid = id;

        if (userName != null)
            this.userName = ByteString.copyFrom(userName);
        if (password != null)
            this.password = ByteString.copyFrom(password);
    }

    @Override
    protected void createCommand() throws CommandException {

        GetCacheManagementPortCommandProtocol.GetCacheManagementPortCommand.Builder builder =
                GetCacheManagementPortCommandProtocol.GetCacheManagementPortCommand.newBuilder()
                        .setCacheId(this.cacheid)
                        .setBinaryUserId(this.userName)
                        .setBinaryPassword(this.password);

            CommandProtocol.Command.Builder commandBuilder = CommandProtocol.Command.newBuilder();

            commandBuilder = commandBuilder.setGetCacheManagementPortCommand(builder)
                    .setRequestID(this.getRequestId())
                    .setType(CommandProtocol.Command.Type.GET_CACHE_MANAGEMENT_PORT);
            super._command = commandBuilder.build();

    }


    /**
     * @return
     */
    @Override
    public CommandType getCommandType() {
        return CommandType.GET_CACHE_MANAGEMENT_PORT;
    }

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

    @Override
    public boolean getSupportsAacknowledgement() {
        return false;
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy