use of com.wordnik.swagger.annotations.ApiOperation in project symmetric-ds by JumpMind.
the class RestService method postRegisterNode.
@ApiOperation(value = "Register the specified node for the specified engine")
@RequestMapping(value = "/engine/{engine}/registernode", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public final RegistrationInfo postRegisterNode(@PathVariable("engine") String engineName, @RequestParam(value = "externalId") String externalId, @RequestParam(value = "nodeGroupId") String nodeGroupId, @RequestParam(value = "databaseType") String databaseType, @RequestParam(value = "databaseVersion") String databaseVersion, @RequestParam(value = "hostName") String hostName) {
ISymmetricEngine engine = getSymmetricEngine(engineName);
IRegistrationService registrationService = engine.getRegistrationService();
INodeService nodeService = engine.getNodeService();
RegistrationInfo regInfo = new org.jumpmind.symmetric.web.rest.model.RegistrationInfo();
try {
org.jumpmind.symmetric.model.Node processedNode = registrationService.registerPullOnlyNode(externalId, nodeGroupId, databaseType, databaseVersion);
regInfo.setRegistered(processedNode.isSyncEnabled());
if (regInfo.isRegistered()) {
regInfo.setNodeId(processedNode.getNodeId());
NodeSecurity nodeSecurity = nodeService.findNodeSecurity(processedNode.getNodeId());
regInfo.setNodePassword(nodeSecurity.getNodePassword());
org.jumpmind.symmetric.model.Node modelNode = nodeService.findIdentity();
regInfo.setSyncUrl(modelNode.getSyncUrl());
// do an initial heartbeat
Heartbeat heartbeat = new Heartbeat();
heartbeat.setNodeId(regInfo.getNodeId());
heartbeat.setHostName(hostName);
Date now = new Date();
heartbeat.setCreateTime(now);
heartbeat.setLastRestartTime(now);
heartbeat.setHeartbeatTime(now);
this.heartbeatImpl(engine, heartbeat);
}
// TODO: Catch a RegistrationRedirectException and redirect.
} catch (IOException e) {
throw new IoException(e);
}
return regInfo;
}
use of com.wordnik.swagger.annotations.ApiOperation in project oxTrust by GluuFederation.
the class TrustRelationshipWebService method delete.
@DELETE
@Path("/delete/{inum}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "delete TrustRelationship", notes = "Delete GluuSAMLTrustRelationship.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 500, message = "Server error") })
public void delete(@PathParam("inum") @NotNull String inum, @Context HttpServletResponse response) {
logger.trace("Delete Trust Relationship");
try {
GluuSAMLTrustRelationship trustRelationship = trustService.getRelationshipByInum(inum);
trustService.removeTrustRelationship(trustRelationship);
} catch (Exception e) {
logger.error("delete() Exception", e);
try {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "INTERNAL SERVER ERROR");
} catch (Exception ex) {
}
}
}
use of com.wordnik.swagger.annotations.ApiOperation in project oxTrust by GluuFederation.
the class TrustRelationshipWebService method setCertificate.
@POST
@Path("/set_certificate/{inum}")
@Consumes({ MediaType.TEXT_PLAIN })
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "set certificate for TrustRelationship", notes = "Find TrustRelationship by inum and set certificate.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 500, message = "Server error") })
public void setCertificate(@PathParam("inum") String trustRelationshipInum, String certificate, @Context HttpServletResponse response) {
try {
GluuSAMLTrustRelationship trustRelationship = trustService.getRelationshipByInum(trustRelationshipInum);
if (StringHelper.isEmpty(certificate)) {
logger.error("Failed to update TR certificate - certificate is empty");
return;
}
updateTRCertificate(trustRelationship, certificate);
} catch (Exception e) {
logger.error("Failed to update certificate", e);
try {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "INTERNAL SERVER ERROR");
} catch (Exception ex) {
}
}
}
use of com.wordnik.swagger.annotations.ApiOperation in project oxTrust by GluuFederation.
the class ScimConfigurationWS method getConfiguration.
@GET
@Produces({ MediaType.APPLICATION_JSON })
@ApiOperation(value = "Provides metadata as json document. It contains options and endpoints supported by the SCIM server.", response = ScimConfiguration.class)
@ApiResponses(value = { @ApiResponse(code = 500, message = "Failed to build SCIM configuration json object.") })
public Response getConfiguration() {
try {
final List<ScimConfiguration> cl = new ArrayList<ScimConfiguration>();
// SCIM 2.0
final ScimConfiguration c2 = new ScimConfiguration();
c2.setVersion("2.0");
c2.setAuthorizationSupported(new String[] { "uma" });
c2.setUserEndpoint(userService.getEndpointUrl());
c2.setUserSearchEndpoint(userService.getEndpointUrl() + "/" + BaseScimWebService.SEARCH_SUFFIX);
c2.setGroupEndpoint(groupService.getEndpointUrl());
c2.setBulkEndpoint(bulkService.getEndpointUrl());
c2.setServiceProviderEndpoint(serviceProviderService.getEndpointUrl());
c2.setResourceTypesEndpoint(resourceTypeService.getEndpointUrl());
cl.add(c2);
// Convert manually to avoid possible conflicts between resteasy providers, e.g. jettison, jackson
final String entity = jsonService.objectToPerttyJson(cl);
log.trace("SCIM configuration: {}", entity);
return Response.ok(entity).build();
} catch (Throwable ex) {
log.error(ex.getMessage(), ex);
throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Failed to generate SCIM configuration").build());
}
}
use of com.wordnik.swagger.annotations.ApiOperation in project oxTrust by GluuFederation.
the class FidoDeviceWebService method deleteDevice.
@Path("{id}")
@DELETE
@Produces({ MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT })
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@ApiOperation(value = "Delete device")
public Response deleteDevice(@PathParam("id") String id) {
Response response;
try {
log.debug("Executing web service method. deleteDevice");
// No need to check id being non-null. fidoDeviceService will give null if null is provided
GluuCustomFidoDevice device = fidoDeviceService.getGluuCustomFidoDeviceById(null, id);
if (device != null) {
fidoDeviceService.removeGluuCustomFidoDevice(device);
response = Response.noContent().build();
} else
response = getErrorResponse(Response.Status.NOT_FOUND, ErrorScimType.INVALID_VALUE, "Resource " + id + " not found");
} catch (Exception e) {
log.error("Failure at deleteDevice method", e);
response = getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
}
return response;
}
Aggregations