void initializeCommands() { // The commands are cached here, but are just referencing the ones // stored in the CommandInitializer this.commands = CommandInitializer.getCommands(this); }
public static Map<Integer, Command> getCommands(ServerConnection connection) { return getCommands(connection.getClientVersion()); } }
/** Return the <code>Version</code> represented by specified ordinal */ public static Version fromOrdinal(short ordinal, boolean forGFEClients) throws UnsupportedVersionException { if (ordinal == TOKEN_ORDINAL) { return TOKEN; } // for clients also check that there must be a commands object mapping // for processing if ((VALUES.length < ordinal + 1) || VALUES[ordinal] == null || (forGFEClients && CommandInitializer.getCommands(VALUES[ordinal]) == null)) { throw new UnsupportedVersionException(String.format( "Peer or client version with ordinal %s not supported. Highest known version is %s", ordinal, CURRENT.name)); } return VALUES[ordinal]; }
@Test public void testCommandMapContainsAllVersions() { for (Version version : Version.getAllVersions()) { org.junit.Assert.assertNotNull( "Please add a commnd set for " + version + " of Geode to CommandInitializer", CommandInitializer.getCommands(version)); } }