Package org.fusesource.ide.fabric8.ui.navigator.properties

Examples of org.fusesource.ide.fabric8.ui.navigator.properties.ProfilesFormSupport


  }

  @Override
  public void createTextFields(Composite parent) {
    this.featuresList = null;
    ProfileDTO profile = node.getProfile();
    String sectionTitle = profile.getId();

    Composite inner = createSectionComposite(sectionTitle, new GridData(GridData.FILL_BOTH));
    createProfileForm(profile, inner);

    createLabel(inner, Messages.profileParentsLabel);
    parentsForm.createColumnsViewer(inner);
    parentsForm.setProfilesViewerInput(node.getVersionNode());
    parentsForm.getProfilesViewer().setContentProvider(new ProfileParentsContentProvider(node));

    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    parentsForm.getProfilesViewer().getTree().setLayoutData(gridData);
    List<ProfileDTO> parents = profile.getParents();
    parentsForm.setCheckedProfiles(parents);
  }
View Full Code Here


  /* (non-Javadoc)
   * @see org.fusesource.ide.commons.ui.form.FormSupport#createTextFields(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected void createTextFields(Composite parent) {
    ProfileDTO profile = node.getProfile();
    String sectionTitle = profile.getId();

    Composite inner = createSectionComposite(sectionTitle, new GridData(GridData.FILL_BOTH));

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
View Full Code Here

    pReqs = reqs.findProfileRequirements(this.node.getProfile().getId());
    if (pReqs != null) {
      this.formModel.setMinInstances(pReqs.getMinimumInstances());
      this.formModel.setMaxInstances(pReqs.getMaximumInstances());
      for (String pId : pReqs.getDependentProfiles()) {
        ProfileDTO p = node.getFabric().getFabricService().getProfile(this.node.getVersionNode().getVersionId(), pId);
        this.formModel.addDependency(p)
      }
    }
    parentsForm.setCheckedProfiles(formModel.getDependencies());
  }
View Full Code Here

  }

  protected ProfileNode getSelectedProfileNode() {
    Object first = Selections.getFirstSelection(getViewer());
    if (first instanceof ProfileStatusDTO) {
      ProfileStatusDTO status = (ProfileStatusDTO) first;
      String id = status.getProfile();
      VersionNode version = getFabric().getDefaultVersionNode();
      if (version != null) {
        return version.getProfileNode(id);
      }
    }
View Full Code Here

  /* (non-Javadoc)
   * @see org.fusesource.ide.fabric8.core.connector.Fabric8ConnectorType#getRequirements()
   */
  @Override
  public RequirementsDTO getRequirements() {
    RequirementsDTO requirements = null;
    try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "requirementsAsJson()");
            J4pExecResponse response = getJolokiaClient().execute(request);
            String json = response.getValue();
      final ModelNode rootNode = JsonHelper.getModelNode(json);
View Full Code Here

    super();
    this.node = node;
  }
 
  private void saveRequirements() {
    RequirementsDTO reqs = this.node.getFabric().getFabricService().getRequirements();
   
    try {
      if (formModel.getMinInstances() == null &&
        formModel.getMaxInstances() == null &&
        formModel.getDependencies().size()==0) {
        // no requirements at all
        if (reqs.findProfileRequirements(this.node.getProfile().getId()) == null) {
          // there is no requirement so we don't save anything
          return;
        } else {
          // there was a requirement but user wants to delete it
          reqs.removeProfileRequirements(this.node.getProfile().getId());
          return;
        }
      }
     
      pReqs = reqs.getOrCreateProfileRequirement(this.node.getProfile().getId());
      pReqs.setMinimumInstances(this.formModel.getMinInstances());
      pReqs.setMaximumInstances(this.formModel.getMaxInstances());
      // create the id list
      List<String> profileDepList = new ArrayList<String>();
      //fill the list
      for (ProfileDTO p : formModel.getDependencies()) {
        profileDepList.add(p.getId());
      }
      // assign it
      pReqs.setDependentProfiles(profileDepList);
      // then save it
      reqs.addOrUpdateProfileRequirements(pReqs);
    } finally {
      this.node.getFabric().getFabricService().setRequirements(reqs);
    }
  }
View Full Code Here

      this.formModel.addDependency(p.getProfile());
    }
  }
 
  private void init() {
    RequirementsDTO reqs = this.node.getFabric().getFabricService().getRequirements();
    pReqs = reqs.findProfileRequirements(this.node.getProfile().getId());
    if (pReqs != null) {
      this.formModel.setMinInstances(pReqs.getMinimumInstances());
      this.formModel.setMaxInstances(pReqs.getMaximumInstances());
      for (String pId : pReqs.getDependentProfiles()) {
        ProfileDTO p = node.getFabric().getFabricService().getProfile(this.node.getVersionNode().getVersionId(), pId);
View Full Code Here

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

      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "versions()");
            J4pExecResponse response = getJolokiaClient().execute(request);
            List<Map<String, Object>> values = response.getValue();
            for (Map<String, Object> value : values) {
              VersionDTO v = new VersionDTO(this.fabricFacade, value);
              if (v.getId().equalsIgnoreCase("master")) continue; // don't show "MASTER" version
              versions.add(new VersionDTO(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#createVersion(java.lang.String, java.lang.String)
   */
  @Override
  public VersionDTO createVersion(String parentVersionId, String versionId) {
    VersionDTO version = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "createVersion(java.lang.String, java.lang.String)", parentVersionId, versionId);
            J4pExecResponse response = getJolokiaClient().execute(request);
            Map<String, Object> values = response.getValue();
            version = new VersionDTO(this.fabricFacade, values);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to create subversion with id '" + versionId + "' under version '" + parentVersionId + "'.", e);
        }
      return version;
  }
View Full Code Here

TOP

Related Classes of org.fusesource.ide.fabric8.ui.navigator.properties.ProfilesFormSupport

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.