Package org.rhq.enterprise.server.rest.domain

Examples of org.rhq.enterprise.server.rest.domain.StringValue


        "agents received the updated plugins.")
    public Response deployOnAgents(
        @ApiParam("The delay in milliseconds before triggering the update on the agents") @QueryParam("delay") @DefaultValue("0") long delay,
        @Context HttpHeaders headers) throws Exception {

        StringValue handle = new StringValue(pluginManager.schedulePluginUpdateOnAgents(caller, delay));

        return withMediaType(Response.ok(handle), headers).build();
    }
View Full Code Here


            List<StringValue> result = new ArrayList<StringValue>(conditions.size());
            for (AlertConditionLog log : conditions) {
                AlertCondition condition = log.getCondition();
                String entry = String.format("category='%s', name='%s', comparator='%s', threshold='%s', option='%s' : %s",
                        condition.getCategory(), condition.getName(), condition.getComparator(), condition.getThreshold(), condition.getOption(), log.getValue() );
                StringValue sv = new StringValue(entry);
                result.add(sv);
            }
            GenericEntity<List<StringValue>> entity = new GenericEntity<List<StringValue>>(result){};
            builder = Response.ok(entity);
        }
View Full Code Here

        List<AlertNotificationLog> notifications =  al.getAlertNotificationLogs();
        if (type.equals(MediaType.APPLICATION_XML_TYPE)) {
            List<StringValue> result = new ArrayList<StringValue>(notifications.size());
            for (AlertNotificationLog log : notifications) {
                String entry = log.getSender() + ": " + log.getResultState() + ": " + log.getMessage();
                StringValue sv = new StringValue(entry);
                result.add(sv);
            }

            GenericEntity<List<StringValue>> entity = new GenericEntity<List<StringValue>>(result){};
            builder = Response.ok(entity);
View Full Code Here

        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile));

        StreamUtil.copy(contentStream, bos, true);

        String fileHandle = outFile.getName();
        StringValue sv = new StringValue(fileHandle);

        UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/content/{handle}");
        URI uri = uriBuilder.build(fileHandle);
View Full Code Here

    @GET
    @Path("/server")
    @ApiOperation(value = "Get the operation mode of this server")
    public StringValue serverState() {
        Server server = serverManager.getServer();
        return new StringValue(server.getOperationMode().name());
    }
View Full Code Here

            builder.location(uri); // redirect to self

        }
        else  // All kinds of failures
            builder = Response.serverError();
            builder.entity(new StringValue(history.getErrorMessage()));
        }
        builder.type(mediaType);
        return builder.build();
    }
View Full Code Here

        try {
            long now = System.currentTimeMillis();
            Resource r = discoveryBoss.manuallyAddResource(caller, resType.getId(), request.getParentId(), defaultPc);          
            if (now > r.getCtime()) {
                builder = Response.serverError();
                builder.entity(new StringValue("Duplicate resource: manuallyAdded resource under same parent having same properties already exists on server. Note that 'resourceName' is ignored."));
                return builder.build();
            }
            if (request.getResourceName()!=null) {
                // resourceName is optional, but if specified, let's update it
                r.setName(request.getResourceName());
                r = resMgr.updateResource(caller, r);
            }
            ResourceWithType rwt = fillRWT(r, uriInfo);

            UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
            uriBuilder.path("/resource/{id}");
            URI uri = uriBuilder.build(r.getId());

            builder = Response.created(uri);
            builder.entity(rwt);
            return builder.build();

        } catch (InvalidPluginConfigurationClientException e) {
            builder = Response.serverError();
            builder.entity(new StringValue(e.getMessage()));
            e.printStackTrace();
        } catch (PluginContainerException e) {
            builder = Response.serverError();
            builder.entity(new StringValue(e.getMessage()));
            e.printStackTrace();
        } catch (Exception e) {
            builder = Response.serverError();
            builder.entity(new StringValue(e.getMessage()));
            e.printStackTrace();
        }
        return builder.build();
    }
View Full Code Here

            builder.location(uri); // redirect to self

        }
        else  // All kinds of failures
            builder = Response.serverError();
            builder.entity(new StringValue(history.getErrorMessage()));
        }
        builder.type(mediaType);

        return builder.build();
View Full Code Here

            builder.entity("Creation is still running - please check back later");
            builder.location(uri); // redirect to self
        }
        else {
            builder = Response.serverError();
            StringValue errorMessage = new StringValue(status + ": " + history.getErrorMessage());
            builder.entity(errorMessage);
        }

        MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
        builder.type(mediaType);
View Full Code Here

            throw new StuffNotFoundException("Definition with id " + definitionId);

        // Call an async method to do the work as this can take a looong time
        metricHandlerBean.submitDefinitionChange(definitionId, in, updateExisting);

        StringValue ret = new StringValue("Request submitted - this may take a while to complete.");

        return Response.ok(ret,headers.getAcceptableMediaTypes().get(0)).build();
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.rest.domain.StringValue

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.