Package org.virtualbox_4_0

Examples of org.virtualbox_4_0.IProgress


    config.store(baos, "This file has been generated by i-OSGi");
    oc.put(baos.toByteArray(), new File(deployDir, f.getPath()));
  }

  private IMachine importAppliance(IVirtualBox vbox, ISession s) {
    IAppliance app = vbox.createAppliance();
    IProgress p = app.read(appliance.getAbsolutePath());
    p.waitForCompletion(-1);
    app.interpret();
    Set<String> oids = this.getMachineIds(vbox);
    p = app.importMachines();
    p.waitForCompletion(-1);
    IMachine machine = null;
    for (IMachine m : vbox.getMachines()) {
      if (!oids.contains(m.getId())) {
        machine = m;
View Full Code Here


      IMachine machine = this.importAppliance(vbox, s);
      /* TODO Headless */
      IProgress p = machine.launchVMProcess(s, "gui", "");
      p.waitForCompletion(-1);
      Thread.sleep(3000);
      IConsole c = s.getConsole();
      String opt = "microcore home=hda1\n";
      send(opt, c.getKeyboard());
      Client oc = this.getOutpost(s, vbox);
      File deployDir = new File("i-osgi");
      deploy(oc, deployDir);
      launch(oc, deployDir, nid);
      oc.close();
View Full Code Here

    VirtualBoxManager vboxMgr = null;
    try {
      vboxMgr = this.connect();
      IVirtualBox vbox = vboxMgr.getVBox();
      ISession s = vboxMgr.getSessionObject();
      IMachine machine = this.importAppliance(vbox, s);
      /* TODO Headless */
      IProgress p = machine.launchVMProcess(s, "gui", "");
      p.waitForCompletion(-1);
      Thread.sleep(3000);
      IConsole c = s.getConsole();
      String opt = "microcore home=hda1\n";
      send(opt, c.getKeyboard());
View Full Code Here

    p.waitForCompletion(-1);
    app.interpret();
    Set<String> oids = this.getMachineIds(vbox);
    p = app.importMachines();
    p.waitForCompletion(-1);
    IMachine machine = null;
    for (IMachine m : vbox.getMachines()) {
      if (!oids.contains(m.getId())) {
        machine = m;
        break;
      }
    }
    machine.lockMachine(s, LockType.Write);
    IMachine mm = s.getMachine();
    mm.setName("iosgi-" + Long.toHexString(System.currentTimeMillis()));
    mm.getNetworkAdapter(0L).setMACAddress(getRandomMACAddress());
    IMedium medium = vbox.openMedium(image.getAbsolutePath(),
        DeviceType.DVD, AccessMode.ReadOnly);
    mm.mountMedium("IDE-Controller", 1, 0, medium, true);
    mm.saveSettings();
    s.unlockMachine();
    return machine;
  }
View Full Code Here

  }

  Set<InetAddress> getVMInetAddresses(ISession session, IVirtualBox vbox)
      throws Exception {
    Set<InetAddress> addresses = new HashSet<InetAddress>();
    IMachine m = session.getMachine();
    long count = 1;// vbox.getSystemProperties().getNetworkAdapterCount();
    for (long i = 0; i < count; i++) {
      INetworkAdapter a = m.getNetworkAdapter(i);
      String raw = a.getMACAddress();
      InetAddress addr = registry.get(new MacAddress(raw), 30,
          TimeUnit.SECONDS);
      addresses.add(addr);
    }
View Full Code Here

    }
    machine.lockMachine(s, LockType.Write);
    IMachine mm = s.getMachine();
    mm.setName("iosgi-" + Long.toHexString(System.currentTimeMillis()));
    mm.getNetworkAdapter(0L).setMACAddress(getRandomMACAddress());
    IMedium medium = vbox.openMedium(image.getAbsolutePath(),
        DeviceType.DVD, AccessMode.ReadOnly);
    mm.mountMedium("IDE-Controller", 1, 0, medium, true);
    mm.saveSettings();
    s.unlockMachine();
    return machine;
View Full Code Here

      throws Exception {
    Set<InetAddress> addresses = new HashSet<InetAddress>();
    IMachine m = session.getMachine();
    long count = 1;// vbox.getSystemProperties().getNetworkAdapterCount();
    for (long i = 0; i < count; i++) {
      INetworkAdapter a = m.getNetworkAdapter(i);
      String raw = a.getMACAddress();
      InetAddress addr = registry.get(new MacAddress(raw), 30,
          TimeUnit.SECONDS);
      addresses.add(addr);
    }
    return addresses;
View Full Code Here

      vboxMgr = this.connect();
      IVirtualBox vbox = vboxMgr.getVBox();
      ISession s = vboxMgr.getSessionObject();
      IMachine machine = this.importAppliance(vbox, s);
      /* TODO Headless */
      IProgress p = machine.launchVMProcess(s, "gui", "");
      p.waitForCompletion(-1);
      Thread.sleep(3000);
      IConsole c = s.getConsole();
      String opt = "microcore home=hda1\n";
      send(opt, c.getKeyboard());
      Client oc = this.getOutpost(s, vbox);
View Full Code Here

        LOGGER.debug("cleaning up {}", m.getName());
        long ref = System.currentTimeMillis();
        try {
          List<IMedium> media = m
              .unregister(CleanupMode.DetachAllReturnHardDisksOnly);
          IProgress p = m.delete(media);
          p.waitForCompletion(-1);
        } catch (Exception e) {
          LOGGER.error("cleaning up " + m.getName() + " failed", e);
        }
        long elapsed = System.currentTimeMillis() - ref;
        LOGGER.debug("cleaned up {} in {} ms",
View Full Code Here

    oc.put(baos.toByteArray(), new File(deployDir, f.getPath()));
  }

  private IMachine importAppliance(IVirtualBox vbox, ISession s) {
    IAppliance app = vbox.createAppliance();
    IProgress p = app.read(appliance.getAbsolutePath());
    p.waitForCompletion(-1);
    app.interpret();
    Set<String> oids = this.getMachineIds(vbox);
    p = app.importMachines();
    p.waitForCompletion(-1);
    IMachine machine = null;
    for (IMachine m : vbox.getMachines()) {
      if (!oids.contains(m.getId())) {
        machine = m;
        break;
View Full Code Here

TOP

Related Classes of org.virtualbox_4_0.IProgress

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.