Package org.jolokia.client.request

Examples of org.jolokia.client.request.J4pExecRequest


   */
  @Override
  public void setProfileRepositories(String versionId, String profileId,
      List<String> repositories) {
    try {
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "setProfileRepositories(java.lang.String, java.lang.String, java.util.List)", versionId, profileId, repositories);
            getJolokiaClient().execute(request);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to set repositories for profile '" + profileId + "'", e);
        }
  }
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) {
View Full Code Here

   * @return
   */
  public void setRequirements(RequirementsDTO requirements) {
    try {
      String json = requirements.toJSon().toJSONString(true);
            J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "requirementsJson(java.lang.String)", json);
            getJolokiaClient().execute(request);
    } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to set 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) {
View Full Code Here

   * @param optionsMap
   * @return
   */
  protected CreateContainerMetadataDTO[] doCreateContainer(Map<String, Object> optionsMap) {
    try {
      J4pExecRequest request = JolokiaHelpers.createExecRequest(FABRIC_MBEAN_URL, "createContainers(java.util.Map)", optionsMap);
            getJolokiaClient().execute(request);
        } catch (Exception e) {
          Fabric8CorePlugin.getLogger().error("Failed to create container", e);
        }
    return new CreateContainerMetadataDTO[0];
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;
View Full Code Here

    return searchResponse == null ? null : searchResponse.getMBeanNames();
  }

  //<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";
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")));
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);
View Full Code Here

        } else if ((attribute = setterAttributeName(method)) != null) {
            request = new J4pWriteRequest(objectName, attribute, args[0]);
        } else {
            name = executeMethodName(method);
            if (args == null | method.getParameterTypes().length == 0) {
                request = new J4pExecRequest(objectName, name);
            } else {
                request = new J4pExecRequest(objectName, name, args);
            }
        }
        try {
            request.setPreferredHttpMethod("POST");
            J4pResponse response = jolokia.execute(request);
View Full Code Here

TOP

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

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.