Examples of PigScript


Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

  @GET
  @Path("{scriptId}")
  @Produces(MediaType.APPLICATION_JSON)
  public Response getScript(@PathParam("scriptId") String scriptId) {
    try {
      PigScript script = null;
      script = getResourceManager().read(scriptId);
      JSONObject object = new JSONObject();
      object.put("script", script);
      return Response.ok(object).build();
    } catch (WebApplicationException ex) {
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

  public Response saveScript(PigScriptRequest request, @Context HttpServletResponse response,
                             @Context UriInfo ui) {
    try {
      getResourceManager().create(request.script);

      PigScript script = null;

      script = getResourceManager().read(request.script.getId());

      response.setHeader("Location",
          String.format("%s/%s", ui.getAbsolutePath().toString(), request.script.getId()));
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

        new OnlyOwnersFilteringStrategy(this.context.getUsername())));
  }

  @Override
  public void createResource(String s, Map<String, Object> stringObjectMap) throws SystemException, ResourceAlreadyExistsException, NoSuchResourceException, UnsupportedPropertyException {
    PigScript script = null;
    try {
      script = new PigScript(stringObjectMap);
    } catch (InvocationTargetException e) {
      throw new SystemException("error on creating resource", e);
    } catch (IllegalAccessException e) {
      throw new SystemException("error on creating resource", e);
    }
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

    getResourceManager().create(script);
  }

  @Override
  public boolean updateResource(String resourceId, Map<String, Object> stringObjectMap) throws SystemException, NoSuchResourceException, UnsupportedPropertyException {
    PigScript script = null;
    try {
      script = new PigScript(stringObjectMap);
    } catch (InvocationTargetException e) {
      throw new SystemException("error on updating resource", e);
    } catch (IllegalAccessException e) {
      throw new SystemException("error on updating resource", e);
    }
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

        return doCreateScript("Luke", "/tmp/luke.pig", scriptService);
    }

    public static Response doCreateScript(String title, String path, ScriptService scriptService) {
        ScriptService.PigScriptRequest request = new ScriptService.PigScriptRequest();
        request.script = new PigScript();
        request.script.setTitle(title);
        request.script.setPigScript(path);

        UriInfo uriInfo = createNiceMock(UriInfo.class);
        URI uri = UriBuilder.fromUri("http://host/a/b").build();
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

    public void updateScript() {
        Response createdScript = doCreateScript();
        String createdScriptId = ((PigScript) ((JSONObject) createdScript.getEntity()).get("script")).getId();

        ScriptService.PigScriptRequest request = new ScriptService.PigScriptRequest();
        request.script = new PigScript();
        request.script.setTitle("Updated Script");

        Response response = scriptService.updateScript(request, createdScriptId);
        Assert.assertEquals(204, response.getStatus());
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

        return doCreateScript("Luke", "/tmp/luke.pig", scriptService);
    }

    public static Response doCreateScript(String title, String path, ScriptService scriptService) {
        ScriptService.PigScriptRequest request = new ScriptService.PigScriptRequest();
        request.script = new PigScript();
        request.script.setTitle(title);
        request.script.setPigScript(path);

        UriInfo uriInfo = createNiceMock(UriInfo.class);
        URI uri = UriBuilder.fromUri("http://host/a/b").build();
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

    public void updateScript() {
        Response createdScript = doCreateScript();
        String createdScriptId = ((PigScript) ((JSONObject) createdScript.getEntity()).get("script")).getId();

        ScriptService.PigScriptRequest request = new ScriptService.PigScriptRequest();
        request.script = new PigScript();
        request.script.setTitle("Updated Script");

        Response response = scriptService.updateScript(request, createdScriptId);
        Assert.assertEquals(204, response.getStatus());
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

   */
  @GET
  @Path("{scriptId}")
  @Produces(MediaType.APPLICATION_JSON)
  public Response getScript(@PathParam("scriptId") String scriptId) {
    PigScript script = null;
    try {
      script = getResourceManager().read(scriptId);
    } catch (ItemNotFound itemNotFound) {
      return Response.status(404).build();
    }
View Full Code Here

Examples of org.apache.ambari.view.pig.resources.scripts.models.PigScript

  @Consumes(MediaType.APPLICATION_JSON)
  public Response saveScript(PigScriptRequest request, @Context HttpServletResponse response,
                             @Context UriInfo ui) {
    getResourceManager().create(request.script);

    PigScript script = null;

    try {
      script = getResourceManager().read(request.script.getId());
    } catch (ItemNotFound itemNotFound) {
      return Response.status(404).build();
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.