Package org.jolokia.client.request

Examples of org.jolokia.client.request.J4pReadRequest


        answer.setPreferredHttpMethod("POST");
        return answer;
    }
 
  public static J4pReadRequest createReadRequest(String mbean, String attribute) throws MalformedObjectNameException {
        J4pReadRequest answer = null;
        if (attribute == null || attribute.toString().trim().length() < 1) {
            answer = new J4pReadRequest(mbean);
        } else {
            answer = new J4pReadRequest(mbean, attribute);
        }
        answer.setPreferredHttpMethod("POST");
        return answer;
    }
View Full Code Here


        return j4p;
    }
   
    public <T extends Object> T read(String attribute) {
      try {
          J4pReadRequest request = JolokiaHelpers.createReadRequest(FABRIC_MBEAN_URL, attribute);
          J4pReadResponse response = j4p.execute(request);
          return response.getValue();
      } catch (Exception e) {
          throw new RuntimeException("Failed to read " + attribute, e);
      }
View Full Code Here

   * @param mbeanName
   * @param string
   * @return
   */
  public String readAttribute(String mbeanName, String attribute) {
    J4pReadRequest readRequest;
    J4pReadResponse readResponse = null;
    try {
      readRequest = new J4pReadRequest(mbeanName, attribute);
      readResponse = j4pClient.execute(readRequest);
    } catch (MalformedObjectNameException e) {
      return e.getMessage();
    } catch (J4pException e) {
      return e.getMessage();
View Full Code Here

                if (jolokia != null) {
                    System.out.println("   has jolokia client: " + jolokia + " from host: " + host + " URL: " + jolokia.getUri());
                    try {
                        ObjectName objectName = new ObjectName("java.lang:type=OperatingSystem");
                        J4pResponse<J4pReadRequest> results = jolokia.execute(new J4pReadRequest(objectName, "SystemCpuLoad"));
                        Object value = results.getValue();
                        System.out.println("  System CPU Load: " + value);
                    } catch (Exception e) {
                        LOG.error("Failed to look up attribute. " + e, e);
                    }
View Full Code Here

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        String name = method.getName();
        String attribute;
        AbtractJ4pMBeanRequest request;
        if ((attribute = getterAttributeName(method)) != null) {
            request = new J4pReadRequest(objectName, attribute);
        } else if ((attribute = setterAttributeName(method)) != null) {
            request = new J4pWriteRequest(objectName, attribute, args[0]);
        } else {
            name = executeMethodName(method);
            if (args == null | method.getParameterTypes().length == 0) {
View Full Code Here

            List<String> mbeanNames = searchResponse.getMBeanNames();
            if (mbeanNames == null || mbeanNames.isEmpty()) {
                getLog().warn("No MBean " + FABRIC_MBEAN + " found, are you sure you have created a fabric in this JVM?");
                return null;
            }
            J4pResponse<J4pReadRequest> request = client.execute(new J4pReadRequest(FABRIC_MBEAN, "MavenRepoUploadURI"));
            Object value = request.getValue();
            if (value != null) {
                String uri = value.toString();
                if (uri.startsWith("http")) {
                    return uri;
View Full Code Here

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            try {
                if (isGetter(method)) {
                    String attname = getAttributeName(method);
                    J4pReadRequest readReq = new J4pReadRequest(objectName, attname);
                    Object result = client.execute(readReq).getValue();
                    return unmarshalResult(method, result);
                } else if (isSetter(method)) {
                    String attname = getAttributeName(method);
                    Object[] params = marshalParameters(method, args);
View Full Code Here

TOP

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

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.