Package org.fusesource.ide.fabric8.core.dto

Examples of org.fusesource.ide.fabric8.core.dto.ContainerDTO


      assertNotNull("Connector is null!", con);

      con.connect();
      assertNotNull("Connector Type is null!", con.getConnection());
     
      Fabric8Facade fabric8 = con.getConnection().getFabricFacade();
      assertNotNull("Fabric8 DTO is null!", fabric8);
     
      ContainerDTO container = fabric8.getContainer("root");
      assertNotNull("getContainer('root') returned NULL!", container);
     
      System.out.println("Debug port for container 'root' : " + container.getDebugPort());
    } catch (IOException ex) {
      fail(ex.getMessage());
View Full Code Here


      assertNotNull("Connector is null!", con);

      con.connect();
      assertNotNull("Connector Type is null!", con.getConnection());
     
      Fabric8Facade fabric8 = con.getConnection().getFabricFacade();
      assertNotNull("Fabric8 DTO is null!", fabric8);
     
      ContainerDTO container = fabric8.getContainer("root");
      assertNotNull("getContainer('root') returned NULL!", container);
     
      assertNotNull("Root container isManaged returns null?!", container.isManaged());   
    } catch (IOException ex) {
      fail(ex.getMessage());
View Full Code Here

      assertNotNull("Connector is null!", con);

      con.connect();
      assertNotNull("Connector Type is null!", con.getConnection());
     
      Fabric8Facade fabric8 = con.getConnection().getFabricFacade();
      assertNotNull("Fabric8 DTO is null!", fabric8);
     
      ContainerDTO container = fabric8.getCurrentContainer();
      assertNotNull("getCurrentContainer() returned NULL!", container);
    } catch (IOException ex) {
      fail(ex.getMessage());
    } finally {
      con.disconnect();
View Full Code Here

      assertNotNull("Connector is null!", con);

      con.connect();
      assertNotNull("Connector Type is null!", con.getConnection());
     
      Fabric8Facade fabric8 = con.getConnection().getFabricFacade();
      assertNotNull("Fabric8 DTO is null!", fabric8);
     
      ContainerDTO container = fabric8.getCurrentContainer();
      assertNotNull("getCurrentContainer() returned NULL!", container);
     
      // TODO: create a new container, start it and check if state is started, delete container
      fabric8.startContainer(container);
    } catch (IOException ex) {
      fail(ex.getMessage());
    } finally {
      con.disconnect();
    }
View Full Code Here

      assertNotNull("Connector is null!", con);

      con.connect();
      assertNotNull("Connector Type is null!", con.getConnection());
     
      Fabric8Facade fabric8 = con.getConnection().getFabricFacade();
      assertNotNull("Fabric8 DTO is null!", fabric8);
     
      ContainerDTO container = fabric8.getCurrentContainer();
      assertNotNull("getCurrentContainer() returned NULL!", container);

      // TODO: create container, start it, check if started, stop it, check if stopped, delete container
      fabric8.stopContainer(container);
    } catch (IOException ex) {
      fail(ex.getMessage());
    } finally {
      con.disconnect();
    }
View Full Code Here

      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "containers()");
            J4pExecResponse response = getJolokiaClient().execute(request);
            List<Map<String, Object>> values = response.getValue();
            for (Map<String, Object> value : values) {
                containers.add(new ContainerDTO(this.fabricFacade, value));
            }
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch containers from fabric8.", e);
        }
     
View Full Code Here

     * (non-Javadoc)
     * @see org.fusesource.ide.fabric8.core.connector.Fabric8ConnectorType#getContainer(java.lang.String)
     */
    @Override
    public ContainerDTO getContainer(String containerId) {
      ContainerDTO container = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "getContainer(java.lang.String)", containerId);
            J4pExecResponse response = getJolokiaClient().execute(request);
            Map<String, Object> values = response.getValue();
            container = new ContainerDTO(this.fabricFacade, values);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch container with ID '" + containerId + "' from fabric8.", e);
        }
      return container;
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.fusesource.ide.fabric8.core.connector.Fabric8ConnectorType#getCurrentContainer()
     */
    @Override
    public ContainerDTO getCurrentContainer() {
      ContainerDTO container = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "currentContainer()");
            J4pExecResponse response = getJolokiaClient().execute(request);
            Map<String, Object> values = response.getValue();
            container = new ContainerDTO(this.fabricFacade, values);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch current container from fabric8.", e);
        }
      return container;
    }
View Full Code Here

  @Override
  public void update(ViewerCell cell) {
    Object element = cell.getElement();
    ContainerViewBean bean = ContainerViewBean.toContainerViewBean(element);
    if (bean != null) {
      ContainerDTO container = bean.container();
      boolean managed = container.isManaged();
      String image = "yellow-dot.png";
      String status = bean.getStatus();

      FabricPlugin.getLogger().debug("Container: " + container.getId() + " alive: " + container.isAlive() + " managed: " + container.isManaged()
          + " pending: " + container.isProvisioningPending() + " complete: " + container.isProvisioningComplete() + " status: " + container.getProvisionStatus());

      if (!bean.isAlive()) {
        image = "gray-dot.png";
      }
      if (container.isProvisioningPending()) {
        //image = "pending.gif";
        image = "yellow-dot.png";
        managed = true;
      } else if (status != null) {
        String lowerStatus = status.toLowerCase();
View Full Code Here

            .getImageDescriptor("terminal_view.gif")) {
      @Override
      public void run() {
        List<ContainerDTO> selectedContainers = getSelectedContainers();
        if (selectedContainers.size() > 0) {
          ContainerDTO container = selectedContainers.get(0);
          if (container != null) {
            ContainerNode
                .openTerminal(getFabric(), container, null);
          }
        }
      }
    };

    startAction = new ActionSupport(Messages.StartAgentAction,
        Messages.StartAgentActionToolTip, FabricPlugin.getDefault()
            .getImageDescriptor("start_task.gif")) {
      @Override
      public void run() {
        start();
      }

      @Override
      public boolean isEnabled() {
        List<ContainerDTO> selectedContainers = getSelectedContainers();
        if (selectedContainers.size() > 0) {
          ContainerDTO container = selectedContainers.get(0);
          if (container != null && container.isRoot()) {
            return false;
          }
        }
        return true;
      }
    };

    stopAction = new ActionSupport(Messages.StopAgentAction,
        Messages.StopAgentActionToolTip, FabricPlugin.getDefault()
            .getImageDescriptor("stop_task.gif")) {
      @Override
      public void run() {
        stop();
      }

      @Override
      public boolean isEnabled() {
        List<ContainerDTO> selectedContainers = getSelectedContainers();
        if (selectedContainers.size() > 0) {
          ContainerDTO container = selectedContainers.get(0);
          if (container != null && container.isRoot()) {
            return false;
          }
        }
        return true;
      }
    };

    destroyAction = new ActionSupport(Messages.DestroyContainerAction,
        Messages.DestroyContainerActionToolTip, FabricPlugin
            .getDefault().getImageDescriptor("delete.gif")) {
      @Override
      public void run() {
        destroy();
      }

      @Override
      public boolean isEnabled() {
        List<ContainerDTO> selectedContainers = getSelectedContainers();
        if (selectedContainers.size() > 0) {
          ContainerDTO container = selectedContainers.get(0);
          if (container != null && container.isRoot()) {
            return false;
          }
        }
        return true;
      }
View Full Code Here

TOP

Related Classes of org.fusesource.ide.fabric8.core.dto.ContainerDTO

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.