Package org.virtualbox_4_0

Examples of org.virtualbox_4_0.IMachine


    try {
      s = vboxMgr.openMachineSession(m);
    } catch (Exception e) {
      throw new IOException(e);
    }
    IProgress p = s.getConsole().powerDown();
    p.waitForCompletion(-1);
    vboxMgr.closeMachineSession(s);
  }
View Full Code Here


    URI nid = URI.create("/" + nextId.getAndIncrement() + "/0");
    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());
      Client oc = this.getOutpost(s, vbox);
      File deployDir = new File("i-osgi");
      deploy(oc, deployDir);
View Full Code Here

    }
  }

  private void shutdownVM(VirtualBoxManager vboxMgr, IMachine m)
      throws IOException {
    ISession s = null;
    try {
      s = vboxMgr.openMachineSession(m);
    } catch (Exception e) {
      throw new IOException(e);
    }
    IProgress p = s.getConsole().powerDown();
    p.waitForCompletion(-1);
    vboxMgr.closeMachineSession(s);
  }
View Full Code Here

    cleanup();
    URI nid = URI.create("/" + nextId.getAndIncrement() + "/0");
    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);
View Full Code Here

  }

  private synchronized void cleanup() {
    VirtualBoxManager vboxMgr = this.connect();
    try {
      IVirtualBox vbox = vboxMgr.getVBox();
      for (IMachine m : vbox.getMachines()) {
        if (m.getState() != MachineState.PoweredOff
            || !m.getName().startsWith("iosgi-")) {
          continue;
        }
        LOGGER.debug("cleaning up {}", m.getName());
View Full Code Here

      if (e.getValue().getAddress()
          .equals(Networking.getPrimaryAddress())) {
        mac = e.getKey();
      }
    }
    IVirtualBox vbox = vboxMgr.getVBox();
    for (final IMachine m : vbox.getMachines()) {
      MacAddress mmac = new MacAddress(m.getNetworkAdapter(0L)
          .getMACAddress());
      if (mmac.equals(mac)) {
        EXEC_SVC.submit(new Callable<Void>() {
          @Override
View Full Code Here

    return id;
  }

  VirtualBoxManager connect() {
    LOGGER.debug("connecting to virtual box remote service");
    VirtualBoxManager vboxMgr = VirtualBoxManager.createInstance(null);
    URL url = virtualBox.getManagerUrl();
    vboxMgr.connect(url.toString(), "user", "pwd");
    LOGGER.debug(
        "connection to virtual box remote service established (Version: {})",
        vboxMgr.getVBox().getVersion());
    return vboxMgr;
  }
View Full Code Here

  public synchronized URI newIsolationEnvironment(
      Map<String, Object> properties) throws IOException,
      TimeoutException, InterruptedException {
    cleanup();
    URI nid = URI.create("/" + nextId.getAndIncrement() + "/0");
    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);
View Full Code Here

    Utils.waitForIsolatedFramework(context, nid, 1, TimeUnit.MINUTES);
    return EnvironmentIDs.getParent(nid);
  }

  private synchronized void cleanup() {
    VirtualBoxManager vboxMgr = this.connect();
    try {
      IVirtualBox vbox = vboxMgr.getVBox();
      for (IMachine m : vbox.getMachines()) {
        if (m.getState() != MachineState.PoweredOff
            || !m.getName().startsWith("iosgi-")) {
          continue;
        }
View Full Code Here

  }

  @Override
  public synchronized void destroy() throws IOException {
    URL url = virtualBox.getManagerUrl();
    final VirtualBoxManager vboxMgr = VirtualBoxManager
        .createInstance(null);
    vboxMgr.connect(url.toString(), "user", "pwd");
    MacAddress mac = null;
    for (Map.Entry<MacAddress, InterfaceAddress> e : MacAddress
        .getAddresses().entrySet()) {
      if (e.getValue().getAddress()
          .equals(Networking.getPrimaryAddress())) {
        mac = e.getKey();
      }
    }
    IVirtualBox vbox = vboxMgr.getVBox();
    for (final IMachine m : vbox.getMachines()) {
      MacAddress mmac = new MacAddress(m.getNetworkAdapter(0L)
          .getMACAddress());
      if (mmac.equals(mac)) {
        EXEC_SVC.submit(new Callable<Void>() {
View Full Code Here

TOP

Related Classes of org.virtualbox_4_0.IMachine

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.