blob: 7bc9987b03d707d6ec2f86af97ab1867bcb96750 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.wst.jsdt.debug.internal.crossfire.transport;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.wst.jsdt.debug.transport.Constants;
/**
* {@link CFPacket} for replying to the Crossfire handshake request
*
* @since 1.0
*/
public class HandShakePacket extends CFPacket {
/**
* handshake
*/
private static String CROSSFIRE_HANDSHAKE;
static {
String hs = "CrossfireHandshake\r\n"; //$NON-NLS-1$
try {
CROSSFIRE_HANDSHAKE = new String(hs.getBytes(), Constants.UTF_8);
} catch (UnsupportedEncodingException e) {
CROSSFIRE_HANDSHAKE = hs;
}
}
/**
* Constructor
* @param type
*/
protected HandShakePacket() {
super(CFResponsePacket.RESPONSE, null);
}
/**
* @return the handshake
*/
public static String getHandshake() {
return CROSSFIRE_HANDSHAKE;
}
/* (non-Javadoc)
* @see org.eclipse.wst.jsdt.debug.internal.crossfire.transport.CFPacket#toString()
*/
public String toString() {
return CROSSFIRE_HANDSHAKE;
}
/* (non-Javadoc)
* @see org.eclipse.wst.jsdt.debug.internal.crossfire.transport.CFPacket#toJSON()
*/
public Map toJSON() {
Map json = new HashMap(1);
json.put(Attributes.HANDSHAKE, CROSSFIRE_HANDSHAKE);
return json;
}
}