blob: 15130570b8704af9730c34d09310b26ac672b74b [file] [log] [blame]
/*=========================================================================
* Copyright (c) 2012 Pivotal Software, Inc. All Rights Reserved.
* This product is protected by U.S. and international copyright
* and intellectual property laws. Pivotal products are covered by
* more patents listed at http://www.pivotal.io/patents.
*=========================================================================
*/
package com.gemstone.gemfire.internal.cache.tier.sockets.command;
import java.io.IOException;
import java.util.Map;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.tier.Command;
import com.gemstone.gemfire.internal.cache.tier.MessageType;
import com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand;
import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
import com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection;
import com.gemstone.gemfire.pdx.internal.EnumInfo;
public class GetPdxEnums70 extends BaseCommand {
private final static GetPdxEnums70 singleton = new GetPdxEnums70();
public static Command getCommand() {
return singleton;
}
private GetPdxEnums70() {
}
@Override
public void cmdExecute(Message msg, ServerConnection servConn, long start)
throws IOException, ClassNotFoundException {
servConn.setAsTrue(REQUIRES_RESPONSE);
if (logger.isDebugEnabled()) {
logger.debug("{}: Received get pdx enums from {}", servConn.getName(), servConn.getSocketString());
}
Map<Integer, EnumInfo> enums;
try {
GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache();
enums = cache.getPdxRegistry().enumMap();
} catch (Exception e) {
writeException(msg, e, false, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
Message responseMsg = servConn.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
responseMsg.setTransactionId(msg.getTransactionId());
responseMsg.addObjPart(enums);
responseMsg.send(servConn);
servConn.setAsTrue(RESPONDED);
}
}