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

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

/*
 * GetCommand.java
 *
 * Created on September 11, 2006, 5:06 PM
 *
 * Copyright 2005 Alachisoft, Inc. All rights reserved.
 * ALACHISOFT PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.alachisoft.ncache.client.internal.command;

import com.alachisoft.ncache.common.protobuf.CommandProtocol;
import com.alachisoft.ncache.common.protobuf.RemoveGroupCommandProtocol;
import com.alachisoft.ncache.runtime.exceptions.CommandException;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;


/**
 * @author Administrator
 * @version 1.0
 */
public final class RemoveGroupCommand extends Command {

    private String group;
    private int _methodOverload = 0;
    protected com.alachisoft.ncache.common.protobuf.RemoveGroupCommandProtocol.RemoveGroupCommand _commandInstance;

    /**
     * Creates a new instance of GetCommand
     *
     * @param key
     * @param group
     * @param isAsync
     */
    public RemoveGroupCommand(String group, boolean isAsync) {
        this.name = "REMOVEGROUP ";
        this.group = group;
        this.isAsync = isAsync;
    }

    /**
     * @return
     */

    protected void createCommand() throws CommandException {

        RemoveGroupCommandProtocol.RemoveGroupCommand.Builder builder =
                RemoveGroupCommandProtocol.RemoveGroupCommand.newBuilder();

        builder.setRequestId(this.getRequestId());

        if (group != null) {
            builder = builder.setGroup(group);
        }


        // String isAsync = this.isAsync? "Y" : "N";
        _commandInstance =builder
                .setClientLastViewId(getClientLastViewId())
                .setMethodOverload(_methodOverload)
                .build();
    }

    public CommandType getCommandType() {
        return CommandType.REMOVE_GROUP;
    }

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

    @Override
    protected  void serializeCommandInternal(ByteArrayOutputStream stream) throws IOException
    {
        _commandInstance.writeTo(stream);
    }
    @Override
    protected short getCommandHandle()
    {
        return (short)CommandProtocol.Command.Type.REMOVE_GROUP.getNumber();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy