Fields Summary |
---|
private static final String | META |
private static final String | HANDSHAKE |
private static final String | CONNECT |
private static final String | DISCONNECT |
private static final String | RECONNECT |
private static final String | SUBSCRIBE |
private static final String | UNSUBSCRIBE |
private static final String | STATUS |
private static final String | PING |
private static final String | DATA |
Methods Summary |
---|
private static void | configureExt(VerbBase vb, java.util.Map map)
Map extMap = (Map)map.get("ext");
if (extMap == null) return;
Ext ext = new Ext();
ext.setExtensionMap(extMap);
vb.setExt(ext);
|
private static final Connect | newConnect(java.util.Map map)
Connect connect = new Connect();
connect.setAuthToken((String)map.get("authToken"));
connect.setChannel((String)map.get("channel"));
connect.setClientId((String)map.get("clientId"));
connect.setConnectionType((String)map.get("connectionType"));
return connect;
|
private static final Data | newData(java.util.Map map)
Data data = new Data();
data.setChannel((String)map.get("channel"));
data.setClientId((String)map.get("clientId"));
data.setData((HashMap)map.get("data"));
return data;
|
private static final Disconnect | newDisconnect(java.util.Map map)
Disconnect disconnect = new Disconnect();
disconnect.setAuthToken((String)map.get("authToken"));
disconnect.setChannel((String)map.get("channel"));
disconnect.setClientId((String)map.get("clientId"));
disconnect.setConnectionType((String)map.get("connectionType"));
return disconnect;
|
private static final Handshake | newHandshake(java.util.Map map)
Handshake handshake = new Handshake();
handshake.setAuthScheme((String)map.get("authScheme"));
handshake.setAuthUser((String)map.get("authUser"));
handshake.setAuthToken((String)map.get("authToken"));
handshake.setChannel((String)map.get("channel"));
handshake.setVersion(String.valueOf((Double)map.get("version")));
handshake.setMinimumVersion(String.valueOf((Double)map.get("minimumVersion")));
handshake.setAdvice(new Advice());
return handshake;
|
private static final Ping | newPing(java.util.Map map)
Ping ping = new Ping();
ping.setChannel((String)map.get("channel"));
return ping;
|
private static final Reconnect | newReconnect(java.util.Map map)
Reconnect reconnect = new Reconnect();
reconnect.setAuthToken((String)map.get("authToken"));
reconnect.setChannel((String)map.get("channel"));
reconnect.setClientId((String)map.get("clientId"));
reconnect.setConnectionType((String)map.get("connectionType"));
return reconnect;
|
private static final Status | newStatus(java.util.Map map)
Status status = new Status();
status.setChannel((String)map.get("channel"));
return status;
|
private static final Subscribe | newSubscribe(java.util.Map map)
Subscribe subscribe = new Subscribe();
subscribe.setChannel((String)map.get("channel"));
subscribe.setAuthToken((String)map.get("authToken"));
subscribe.setSubscription((String)map.get("subscription"));
subscribe.setClientId((String)map.get("clientId"));
return subscribe;
|
private static final Unsubscribe | newUnsubscribe(java.util.Map map)
Unsubscribe unsubscribe = new Unsubscribe();
unsubscribe.setChannel((String)map.get("channel"));
unsubscribe.setAuthToken((String)map.get("authToken"));
unsubscribe.setSubscription((String)map.get("subscription"));
unsubscribe.setClientId((String)map.get("clientId"));
return unsubscribe;
|
public static Verb | parse(java.lang.Object verb)
if (verb.getClass().isArray()){
int length = Array.getLength(verb);
for (int i=0; i < length; i++){
return parseMap((Map)Array.get(verb,i));
}
}
throw new RuntimeException("Wrong type");
|
protected static Verb | parseMap(java.util.Map map)
String channel = (String)map.get("channel");
if (!channel.startsWith(META)){
return newData(map);
}
VerbBase vb = null;
if (channel.indexOf(HANDSHAKE) != -1){
vb = newHandshake(map);
} else if (channel.indexOf(CONNECT) != -1){
vb = newConnect(map);
} else if (channel.indexOf(DISCONNECT) != -1){
vb = newDisconnect(map);
} else if (channel.indexOf(RECONNECT) != -1){
vb = newReconnect(map);
} else if (channel.indexOf(SUBSCRIBE) != -1){
vb = newSubscribe(map);
} else if (channel.indexOf(UNSUBSCRIBE) != -1){
vb = newUnsubscribe(map);
} else if (channel.indexOf(PING) != -1){
vb = newPing(map);
} else if (channel.indexOf(STATUS) != -1){
vb = newStatus(map);
}
configureExt(vb,map);
return vb;
|