Package jNab.core.bunny

Examples of jNab.core.bunny.Bunny


     * @param ps the character stream where to write command processing output.
     * @return a connection state indication, either <tt>KEEP_ALIVE</tt>, <tt>CLIENT_SHUTDOWN</tt> or <tt>SERVER_SHUTDOWN</tt>.
     */
    private int handleSaveBunnyCommand(String bunnySerial, PrintStream ps)
    {
  Bunny bunny = null;
  try
  {
      bunny = this.microServer.getBurrow().getBunny(bunnySerial);
  }
  catch (NoSuchBunnyException e)
View Full Code Here


  String bunnySerial = cmdParameters.substring(0, indexOfSpace).trim();
  String pluginName = cmdParameters.substring(indexOfSpace).trim();

  try
  {
      Bunny bunny = this.microServer.getBurrow().getBunny(bunnySerial);
      AbstractPlugin plugin = bunny.getPluginByName(pluginName);
      bunny.removePlugin(plugin);
      ps.println("OK");
  }
  catch (NoSuchBunnyException e)
  {
      ps.println("KO (no such bunny)");
View Full Code Here

  String paramValue = cmdParameters.substring(indexOfSpace).trim();

  try
  {
      Bunny bunny = this.microServer.getBurrow().getBunny(bunnySerial);
      AbstractPlugin plugin = bunny.getPluginByName(pluginName);
      if (plugin.setParameter(paramName, paramValue))
    ps.println("KO (no such parameter)");
      else
    ps.println("OK");
  }
View Full Code Here

  int serialBytesLength = dis.readInt();
  byte[] serialBytes = new byte[serialBytesLength];
  dis.readFully(serialBytes);
  String serialNumber = new String(serialBytes, "US-ASCII");

  Bunny bunny = new Bunny(serialNumber);

  // Reading bunny name
  int nameBytesLength = dis.readInt();
  byte[] nameBytes = new byte[nameBytesLength];
  dis.readFully(nameBytes);
  bunny.setName(new String(nameBytes, "US-ASCII"));

  // Reading ping interval
  bunny.setPingInterval(dis.readInt());

  // Reading plugins count
  int pluginCount = dis.readInt();

  for (int i = 0; i < pluginCount; i++)
  {
      // Reading plugin
      AbstractPlugin plugin = null;
      try
      {
    plugin = this.readPluginFromInputStream(dis, pluginFactory);
      }
      catch (PluginCreationException e)
      {
    continue;
      }

      // Adding plugin
      plugin.setBunny(bunny);
      bunny.addPlugin(plugin);
  }

  return bunny;
    }
View Full Code Here

  String bunnySerial = cmdParameters.substring(0, indexOfSpace).trim();
  String pluginName = cmdParameters.substring(indexOfSpace).trim();

  try
  {
      Bunny bunny = this.microServer.getBurrow().getBunny(bunnySerial);
      AbstractPlugin plugin = this.microServer.getPluginFactory().createPlugin(pluginName);
      bunny.addPlugin(plugin);
      ps.println("OK");
  }
  catch (NoSuchBunnyException e)
  {
      ps.println("KO (no such bunny)");
View Full Code Here

  for (File f : new File(this.serializedFilesPath, "bunnies").listFiles(new SerFileNameFilter()))
  {
      try
      {
    FileInputStream fis = new FileInputStream(f);
    Bunny bunny = this.readBunnyFromInputStream(fis, pluginFactory);
    try
    {
        fis.close();
    }
    catch (IOException e)
View Full Code Here

      ps.println("KO (syntax error)");
      return KEEP_ALIVE;
  }
  try
  {
      Bunny bunny = this.microServer.getBurrow().getBunny(bunnySerial);
      bunny.setPingInterval(bunnyPing);
      ps.println("OK");
  }
  catch (NoSuchBunnyException e)
  {
      ps.println("KO (no such bunny)");
View Full Code Here

  String bunnySerial = cmdParameters.substring(0, indexOfSpace).trim();
  String bunnyName = cmdParameters.substring(indexOfSpace).trim();

  try
  {
      Bunny bunny = this.microServer.getBurrow().getBunny(bunnySerial);
      bunny.setName(bunnyName);
      ps.println("OK");
  }
  catch (NoSuchBunnyException e)
  {
      ps.println("KO (no such bunny)");
View Full Code Here

     */
    private int handleInfoBunnyCommand(String cmdParameters, PrintStream ps)
    {
  try
  {
      Bunny bunny = this.microServer.getBurrow().getBunny(cmdParameters);
      ps.println("Name: " + bunny.getName());
      ps.println("Ping interval: " + bunny.getPingInterval());
      Set<AbstractPlugin> plugins = bunny.getPlugins();
      ps.println("" + plugins.size() + " plugins: ");

      for (AbstractPlugin plugin : plugins)
      {
    ps.println(plugin.getName());
View Full Code Here

TOP

Related Classes of jNab.core.bunny.Bunny

Copyright © 2018 www.massapicom. 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.