Examples of StringRepresentation


Examples of org.restlet.resource.StringRepresentation

  }

  @Override
  public Representation represent(Variant variant)
  {
    StringRepresentation presentation = null;
    try
    {
      presentation = getInstanceRepresentation();
    }
    catch (Exception e)
    {
      String error = ClusterRepresentationUtil.getErrorAsJsonStringFromException(e);
      presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);

      LOG.error("", e);
    }
    return presentation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

        ClusterRepresentationUtil.getClusterPropertyAsString(zkClient,
                                                             clusterName,
                                                             MediaType.APPLICATION_JSON,
                                                             keyBuilder.instanceConfig(instanceName));

    StringRepresentation representation =
        new StringRepresentation(message, MediaType.APPLICATION_JSON);

    return representation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

  }
 
  @Override
  public Representation represent(Variant variant)
  {
    StringRepresentation presentation = null;
    try
    {
      presentation = getSchedulerTasksRepresentation();
    }
   
    catch(Exception e)
    {
      String error = ClusterRepresentationUtil.getErrorAsJsonStringFromException(e);
      presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);

      LOG.error("", e);
   
    return presentation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

   
    HelixDataAccessor accessor = ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
    LiveInstance liveInstance = accessor.getProperty(accessor.keyBuilder().liveInstance(instanceName));
    String sessionId = liveInstance.getSessionId();
   
    StringRepresentation representation = new StringRepresentation("");//(ClusterRepresentationUtil.ObjectToJson(instanceConfigs), MediaType.APPLICATION_JSON);
   
    return representation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

    boolean paused = (accessor.getProperty(keyBuilder.pause()) == null ? false : true);
    record.setSimpleField(PropertyType.PAUSE.toString(), "" + paused);

    String retVal = ClusterRepresentationUtil.ZNRecordToJson(record);
    StringRepresentation representation =
        new StringRepresentation(retVal, MediaType.APPLICATION_JSON);

    return representation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

  }

  @Override
  public Representation represent(Variant variant)
  {
    StringRepresentation presentation = null;
    try
    {
      String clusterName = (String) getRequest().getAttributes().get("clusterName");
      presentation = getControllerRepresentation(clusterName);
    }
    catch (Exception e)
    {
      String error = ClusterRepresentationUtil.getErrorAsJsonStringFromException(e);
      presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);
      e.printStackTrace();
    }
    return presentation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

  }

  @Override
  public Representation represent(Variant variant)
  {
    StringRepresentation presentation = null;
    try
    {
      String clusterName = (String) getRequest().getAttributes().get("clusterName");
      String instanceName = (String) getRequest().getAttributes().get("instanceName");
      presentation = getInstanceErrorsRepresentation( clusterName, instanceName);
    }
    catch (Exception e)
    {
      String error = ClusterRepresentationUtil.getErrorAsJsonStringFromException(e);
      presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);

      LOG.error("", e);
    }
    return presentation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

    ZkClient zkClient = (ZkClient)getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
    String instanceSessionId = ClusterRepresentationUtil.getInstanceSessionId(zkClient, clusterName, instanceName);
   
    String message = ClusterRepresentationUtil.getInstancePropertyNameListAsString(zkClient, clusterName, instanceName, PropertyType.CURRENTSTATES, instanceSessionId, MediaType.APPLICATION_JSON);

    StringRepresentation representation = new StringRepresentation(message, MediaType.APPLICATION_JSON);

    return representation;
  }
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

  }

  @Override
  public Representation represent(Variant variant)
  {
    StringRepresentation presentation = null;
    String zkPath = getZKPath();

    try
    {
      ZkClient zkClient =
          (ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
      ZNRecord result = readZkDataStatAndChild(zkPath, zkClient);

      presentation =
          new StringRepresentation(ClusterRepresentationUtil.ZNRecordToJson(result),
                                   MediaType.APPLICATION_JSON);
    }
    catch (Exception e)
    {
      String error = ClusterRepresentationUtil.getErrorAsJsonStringFromException(e);
      presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);

      LOG.error("Error in read zkPath: " + zkPath, e);
    }

    return presentation;
View Full Code Here

Examples of org.restlet.resource.StringRepresentation

  }

  @Override
  public Representation represent(Variant variant)
  {
    StringRepresentation presentation = null;
    try
    {
      String clusterName = (String) getRequest().getAttributes().get("clusterName");
      String instanceName = (String) getRequest().getAttributes().get("instanceName");
      String resourceGroup = (String) getRequest().getAttributes().get("resourceName");

      presentation =
          getInstanceStatusUpdateRepresentation(
                                                clusterName,
                                                instanceName,
                                                resourceGroup);
    }
    catch (Exception e)
    {
      String error = ClusterRepresentationUtil.getErrorAsJsonStringFromException(e);
      presentation = new StringRepresentation(error, MediaType.APPLICATION_JSON);

      LOG.error("", e);
    }
    return presentation;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.