Package org.jolokia.client.request

Examples of org.jolokia.client.request.J4pExecResponse


  @Override
  public ProfileDTO getProfile(String versionId, String profileId) {
    ProfileDTO profile = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "getProfile(java.lang.String, java.lang.String)", versionId, profileId);
            J4pExecResponse response = getJolokiaClient().execute(request);
            Map<String, Object> values = response.getValue();
            profile = new ProfileDTO(this.fabricFacade, values);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch profile with id '" + profileId + "' and version id '" + versionId + "'.", e);
        }
      return profile;
View Full Code Here


  @Override
  public ProfileDTO createProfile(String versionId, String profileId) {
    ProfileDTO profile = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "createProfile(java.lang.String, java.lang.String)", versionId, profileId);
            J4pExecResponse response = getJolokiaClient().execute(request);
            Map<String, Object> values = response.getValue();
            profile = new ProfileDTO(this.fabricFacade, values);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to create profile with id '" + profileId + "' and version id '" + versionId + "'.", e);
        }
      return profile;
View Full Code Here

  @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

  @Override
  public VersionDTO getDefaultVersion() {
    VersionDTO version = null;
      try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "defaultVersion()");
            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 fetch current container from fabric8.", e);
        }
      return version;
View Full Code Here

  @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);
      requirements = RequirementsDTO.fromJson(fabricFacade, rootNode);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch requirements", e);
        }
View Full Code Here

  @Override
  public FabricStatusDTO getFabricStatus() {
    FabricStatusDTO status = null;
    try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "fabricStatusAsJson()");
            J4pExecResponse response = getJolokiaClient().execute(request);
            String json = response.getValue();
            final ModelNode rootNode = JsonHelper.getModelNode(json);
      status = FabricStatusDTO.fromJson(fabricFacade, rootNode);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to fetch fabric status", e);
        }
View Full Code Here

  @Override
  public LogResultsDTO queryLog(LogFilter filter) {
    try {
      String filterJson = JsonHelper.convertToJson(filter);
      J4pExecRequest request = JolokiaHelpers.createExecRequest(INSIGHT_MBEAN_URL, "filterLogEvents(java.lang.String)", filterJson);
          J4pExecResponse response = getJolokiaClient().execute(request);
          String json = response.getValue();
          final ModelNode rootNode = JsonHelper.getModelNode(json);
      LogResultsDTO result = LogResultsDTO.fromJson(rootNode);
      return result;
    } catch (Exception e) {
      Fabric8CorePlugin.getLogger().error("Failed to query the logs", e);
View Full Code Here

  //<base url>/exec/<mbean name>/<operation name>/<arg1>/<arg2>/....
  public String execOperation(String mbeanName, String opName, Object... args) throws MalformedObjectNameException, J4pException {
    J4pExecRequest exec;
    String result = null;
    exec = new J4pExecRequest(mbeanName, opName, args);
    J4pExecResponse execResp = j4pClient.execute(exec);
    if (execResp.getValue() != null) {
      result = execResp.getValue().toString();
    } else {
      result = opName + " executed";
    }
    return result;
  }
View Full Code Here

    @Override
    public Container[] getContainers() {
        List<Container> containers = new ArrayList<Container>();
        try {
            J4pExecRequest request = Helpers.createExecRequest("containers(java.util.List)", toList("id"));
            J4pExecResponse response = getJolokiaClient().execute(request);
            List<Map<String, Object>> values = response.getValue();

            for (Map<String, Object> value : values) {
                containers.add(new ContainerFacade(this, getJolokiaClient(), (String)value.get("id")));
            }
        } catch (Exception e) {
View Full Code Here

  @SuppressWarnings("unchecked")
  private static <T extends Object> T getFieldValue(J4pClient j4p, String operation, String versionId, String id, String field) {
        T rc = null;
        try {
            J4pExecRequest request = Helpers.createExecRequest(operation, versionId, id, Helpers.toList(field));
            J4pExecResponse response = j4p.execute(request);
            Map<String, Object> value = response.getValue();
            rc = (T)value.get(field);
        } catch (MalformedObjectNameException e) {
            throw new RuntimeException("Failed to get container field", e);
        } catch (J4pException e) {
            throw new RuntimeException("Failed to get container field", e);
View Full Code Here

TOP

Related Classes of org.jolokia.client.request.J4pExecResponse

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.