/** * Creates a new instance of a command to be used by a new execution request * * @param commandNode the command node that identifies it. * @param sessionID the session id of this execution. * @return the command instance to execute. * @throws XMPPException if there is problem creating the new instance. */ private LocalCommand newInstanceOfCmd(String commandNode, String sessionID) throws XMPPException { AdHocCommandInfo commandInfo = commands.get(commandNode); LocalCommand command; try { command = (LocalCommand) commandInfo.getCommandInstance(); command.setSessionID(sessionID); command.setName(commandInfo.getName()); command.setNode(commandInfo.getNode()); } catch (InstantiationException e) { e.printStackTrace(); throw new XMPPException(new XMPPError(XMPPError.Condition.interna_server_error)); } catch (IllegalAccessException e) { e.printStackTrace(); throw new XMPPException(new XMPPError(XMPPError.Condition.interna_server_error)); } return command; }