Examples of Bot


Examples of agh.sr.rmi.client.Bot

        List<Bot> result = new ArrayList<>();
        for (int i = 0; i < botsCount; i++) {
            PlayerToken playerToken = new PanPlayerToken(gameName + "_bot_" + i, BOTS_ID);
            BotGameListener botGameListener = new BotGameListener(playerToken);
            Bot bot = new PanBot(playerToken, botGameListener);
            result.add(bot);
        }
        return result;
    }
View Full Code Here

Examples of com.uwyn.drone.core.Bot

    }
    else
    {
      botname = getInput("botname");
    }
    Bot bot = Home.validateBotName(errors, botname);
   
    // act according to the actions that were performed
    if (errors.size() > 0)
    {
      if (botname != null)
      {
        t.setValue("botname", encodeHtml(botname));
      }
      validation_builder.generateValidationErrors(t, errors, null, null);
      validation_builder.generateErrorMarkings(t, errors, null, null);
    }
    else
    {
      if (hasSubmission("perform_change"))
      {
        String new_nick = getParameter("new_nick");
       
        t.setValue("botname", encodeHtml(bot.getName()));
        t.setValue("nick", encodeHtml(new_nick));

        try
        {
          bot.addBotListener(this);
          bot.changeNick(new_nick);
          synchronized (this)
          {
            if (null == bot.getConnectedNick() ||
              !bot.getConnectedNick().equals(new_nick))
            {
              try
              {
                this.wait();
              }
              catch (InterruptedException e)
              {
                // do nothing
              }
            }
          }
          bot.removeBotListener(this);
         
          if (bot.getConnectedNick().equals(new_nick))
          {
            exit("nick_changed");
          }
          validation_builder.setFallbackErrorArea(t, t.getBlock("ERROR_CHANGING_NICK"));
        }
View Full Code Here

Examples of com.uwyn.drone.core.Bot

  {
    ValidationBuilderXhtml builder = new ValidationBuilderXhtml();
   
    ArrayList  errors = new ArrayList();
    String    botname = getParameter("bot_to_pause");
    Bot      bot = Home.validateBotName(errors, botname);
    if (null == bot)
    {
      if (botname != null)
      {
        mTemplate.setValue("botname", encodeHtml(botname));
      }
      builder.generateValidationErrors(mTemplate, errors, null, null);
      processElement();
      return;
    }
   
    try
    {
      bot.pause();
    }
    catch (CoreException e)
    {
      builder.setFallbackErrorArea(mTemplate, "Error while pausing the bot '"+encodeHtml(bot.getName())+"' : "+ExceptionUtils.getExceptionStackTrace(e));
    }
   
    processElement();
  }
View Full Code Here

Examples of com.uwyn.drone.core.Bot

  {
    ValidationBuilderXhtml builder = new ValidationBuilderXhtml();
   
    ArrayList  errors = new ArrayList();
    String    botname = getParameter("bot_to_resume");
    Bot      bot = Home.validateBotName(errors, botname);
    if (null == bot)
    {
      if (botname != null)
      {
        mTemplate.setValue("botname", encodeHtml(botname));
      }
      builder.generateValidationErrors(mTemplate, errors, null, null);
      processElement();
      return;
    }

    try
    {
      bot.resume();
    }
    catch (CoreException e)
    {
      builder.setFallbackErrorArea(mTemplate, "Error while resuming the bot '"+encodeHtml(bot.getName())+"' : "+ExceptionUtils.getExceptionStackTrace(e));
    }
   
    processElement();
  }
View Full Code Here

Examples of com.uwyn.drone.core.Bot

  {
    ValidationBuilderXhtml builder = new ValidationBuilderXhtml();
   
    ArrayList  errors = new ArrayList();
    String    botname = getParameter("bot_to_reconnect");
    Bot      bot = Home.validateBotName(errors, botname);
    if (null == bot)
    {
      if (botname != null)
      {
        mTemplate.setValue("botname", encodeHtml(botname));
      }
      builder.generateValidationErrors(mTemplate, errors, null, null);
      processElement();
      return;
    }

    try
    {
      bot.addBotListener(this);
      synchronized (this)
      {
        bot.redoLogon();
       
        try
        {
          this.wait();
        }
        catch (InterruptedException e)
        {
          // do nothing
        }
      }
      bot.removeBotListener(this);
    }
    catch (CoreException e)
    {
      builder.setFallbackErrorArea(mTemplate, "Error while reconnecting the bot '"+encodeHtml(bot.getName())+"' : "+ExceptionUtils.getExceptionStackTrace(e));
    }
    processElement();
  }
View Full Code Here

Examples of com.uwyn.drone.core.Bot

 
  private void generateBotsList()
  {
    Collection  bots = ((BotsRunner)Rep.getParticipant("com.uwyn.drone.core.DroneParticipant").getObject()).getBots();
    Iterator  bots_it = bots.iterator();
    Bot      bot = null;
    while (bots_it.hasNext())
    {
      bot = (Bot)bots_it.next();
      mTemplate.setValue("botname", encodeHtml(bot.getName()));
      mTemplate.setValue("connected_nick", encodeHtml(bot.getConnectedNick()));
      mTemplate.setValue("nicks", encodeHtml(bot.getNick()+", "+bot.getAltNick()));
      if (bot.isPaused())
      {
        setSubmissionForm(mTemplate, "resume", new String[] {"bot_to_resume", bot.getName()});
        mTemplate.setBlock("actions", "action_resume");
      }
      else
      {
        setSubmissionForm(mTemplate, "pause", new String[] {"bot_to_pause", bot.getName()});
        mTemplate.setBlock("actions", "action_pause");
      }
      setExitForm(mTemplate, "change_nick", new String[] {"botname", bot.getName()});
      setSubmissionForm(mTemplate, "reconnect", new String[] {"bot_to_reconnect", bot.getName()});
      mTemplate.appendBlock("actions", "action_reconnect");
      mTemplate.appendBlock("actions", "action_changenick");
     
      mTemplate.appendBlock("bots", "bot");
    }
View Full Code Here

Examples of com.uwyn.drone.core.Bot

  }
 
  public void run()
  {
    Iterator  bots_it = null;
    Bot      bot = null;
    try
    {
      bots_it = mBots.iterator();
      while (bots_it.hasNext())
      {
        bot = (Bot)bots_it.next();
       
        bot.addBotListener(this);
        bot.logon();

        // wait for bot startup
        if (null == mBotError &&
          !bot.isLoggedOn())
        {
          try
          {
            synchronized (mBotsMonitor)
            {
              mBotsMonitor.wait();
            }
          }
          catch (InterruptedException e)
          {
            // do nothing, just let other threads execute
            Thread.yield();
          }
        }
      }
     
     
      // wait for bot termination
      while (areBotsLoggedOn() &&
           !isInterrupted())
      {
        try
        {
          synchronized (mBotsMonitor)
          {
            mBotsMonitor.wait();
          }
        }
        catch (InterruptedException e)
        {
          break;
        }
      }
     
      // disconnect the bots
      bots_it = mBots.iterator();
      while (bots_it.hasNext())
      {
        bot = (Bot)bots_it.next();
        bot.disconnect();
      }
     
      fireFinished();
    }
    catch (CoreException e)
View Full Code Here

Examples of com.uwyn.drone.core.Bot

    String  bot_name = null;
    try
    {
      bot_name = task.getTaskoptionValue("bot");
     
      Bot bot = BotFactory.get(bot_name);
      if (bot != null)
      {
        DatabaseFaqs  database_faq = DatabaseFaqsFactory.get();
        FaqData      faq_data = database_faq.getRandomFaq(bot);
        if (faq_data != null)
        {
          Iterator  channels_it = bot.getJoinedChannels().iterator();
          Channel    channel = null;
          while (channels_it.hasNext())
          {
            channel = (Channel)channels_it.next();
            channel.send(faq_data.getName()+": "+faq_data.getAnswer());
View Full Code Here

Examples of com.uwyn.drone.core.Bot

  public final void processElement()
  {
    ArrayList errors = new ArrayList();

    Bot      bot = null;
    Channel    channel = null;
    Calendar  day = null;

    String botname = null;
    String channelname = null;
View Full Code Here

Examples of com.uwyn.drone.core.Bot

        Iterator   iter = bots.iterator();

        String readerDir = null;
        while (iter.hasNext())
        {
          Bot bot = (Bot)iter.next();

          if (bot.getName().equals(getInput("botname")))
          {
            StringBuffer key = new StringBuffer();
            key
              .append(Config.getRepInstance().getString("LUCENE_DIR"))
              .append(File.separator)
              .append(bot.getName())
              .append("-")
              .append(bot.getServer().getServerName())
              .append("-")
              .append(getInput("channelname").substring(1));

            readerDir = key.toString();
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.