下面列出了org.springframework.http.HttpStatus#GONE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@RequestMapping(value = BASE_PATH + "/{bindingId}", method = RequestMethod.DELETE)
public ResponseEntity<String> deleteServiceInstanceBinding(
@PathVariable("instanceId") String instanceId,
@PathVariable("bindingId") String bindingId,
@RequestParam("service_id") String serviceId,
@RequestParam("plan_id") String planId) throws ServiceBrokerException, ServiceInstanceDoesNotExistException, ServiceBrokerAsyncRequiredException {
logger.debug( "DELETE: " + BASE_PATH + "/{bindingId}"
+ ", deleteServiceInstanceBinding(), serviceInstance.id = " + instanceId
+ ", bindingId = " + bindingId
+ ", serviceId = " + serviceId
+ ", planId = " + planId);
ServiceInstance instance = serviceInstanceService.getServiceInstance(instanceId);
if (instance == null) {
throw new ServiceInstanceDoesNotExistException(instanceId);
}
ServiceInstanceBinding binding = serviceInstanceBindingService.deleteServiceInstanceBinding(
new DeleteServiceInstanceBindingRequest( bindingId, instance, serviceId, planId));
if (binding == null) {
return new ResponseEntity<>("{}", HttpStatus.GONE);
}
logger.debug("ServiceInstanceBinding Deleted: " + binding.getId());
return new ResponseEntity<>("{}", HttpStatus.OK);
}
/**
* 拦截API接口版本弃用异常-410
*
* @param e API接口版本弃用异常
* @return 结果
*/
@ResponseBody
@ResponseStatus(code = HttpStatus.GONE)
@ExceptionHandler(ApiVersionDeprecatedException.class)
public Result<?> apiVersionDeprecatedExceptionHandler(ApiVersionDeprecatedException e) {
ExceptionUtils.printException(e);
return ResultInfo.gone();
}
/**
* triple파일을 DM로 전송
* @param triple_path_file
* @return String[]
* @throws Exception
*/
public String[] sendTripleFileToDM(String triple_path_file) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dm.sparql.endpoint");
args[2] = "default";
args[3] = triple_path_file;
log.info("sendTripleFile to DM start==========================>");
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("sendTripleFile to DM ==============args============>" + sb.toString());
// 전송 실행
result = Utils.runShell(sb);
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.sendTripleFileToDM() == > "+ result[1]);
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
} else {
// pass
}
log.info("sendTripleFile to DM end==========================>");
return result;
}
/**
* triple파일을 DM로 전송
* @param triple_path_file
* @return String[]
* @throws Exception
*/
public String[] sendTripleFileToDM(String triple_path_file) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dm.sparql.endpoint");
args[2] = "default";
args[3] = triple_path_file;
log.info("sendTripleFile to DM start==========================>");
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("sendTripleFile to DM ==============args============>" + sb.toString());
// 전송 실행
result = Utils.runShell(sb);
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.sendTripleFileToDM() == > "+ result[1]);
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
} else {
// pass
}
log.info("sendTripleFile to DM end==========================>");
return result;
}
@Override
public ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
@PathVariable("tenant") final String tenant, @PathVariable("controllerId") final String controllerId,
@PathVariable("actionId") @NotEmpty final Long actionId) {
LOG.debug("provideBasedeploymentActionFeedback for target [{},{}]: {}", controllerId, actionId, feedback);
final Target target = controllerManagement.getByControllerId(controllerId)
.orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId));
if (!actionId.equals(feedback.getId())) {
LOG.warn(
"provideBasedeploymentActionFeedback: action in payload ({}) was not identical to action in path ({}).",
feedback.getId(), actionId);
return ResponseEntity.notFound().build();
}
final Action action = findActionWithExceptionIfNotFound(actionId);
if (!action.getTarget().getId().equals(target.getId())) {
LOG.warn(GIVEN_ACTION_IS_NOT_ASSIGNED_TO_GIVEN_TARGET, action.getId(), target.getId());
return ResponseEntity.notFound().build();
}
if (!action.isActive()) {
LOG.warn("Updating action {} with feedback {} not possible since action not active anymore.",
action.getId(), feedback.getId());
return new ResponseEntity<>(HttpStatus.GONE);
}
controllerManagement.addUpdateActionStatus(generateUpdateStatus(feedback, controllerId, feedback.getId()));
return ResponseEntity.ok().build();
}
Gone(String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset) {
super(HttpStatus.GONE, statusText, headers, body, charset);
}
Gone(String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset) {
super(HttpStatus.GONE, statusText, headers, body, charset);
}
public String[] sendTripleFile(String triple_path_file) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.sparql.endpoint");
args[2] = "default";
args[3] = triple_path_file;
log.info("sendTripleFile start==========================>");
log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);
// 개수확인(before)
Utils.getTripleCount();
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("sendTripleFile ==============args============>" + sb.toString());
// 실행
result = Utils.runShell(sb);
log.debug("resultStr in TripleService.sendTripleFile() == > "+ Arrays.toString(result));
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.sendTripleFile() == > "+ result[1]);
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
log.info("sendTripleFile end==========================>");
// 개수확인(after)
Utils.getTripleCount();
return result;
}
/**
* triple파일을 DW로 전송
* @param triple_path_file
* @throws Exception
* @return String[]
*/
public String[] sendTripleFileToDW(String triple_path_file) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dw.sparql.endpoint");
args[2] = "default";
args[3] = triple_path_file;
log.info("sendTripleFile to DW start==========================>");
log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("sendTripleFile ==============args============>" + sb.toString());
// 실행(1차)
log.debug("try (first).......................");
result = Utils.runShell(sb);
log.debug("resultStr in TripleService.sendTripleFileToDW() == > "+ Arrays.toString(result));
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.sendTripleFileToDW() == > "+ result[1]);
int waitTime = 15*1000;
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
log.debug("sleep (first)...........................");
// 일정시간을 대기 한다.(1차)
Thread.sleep(waitTime);
// restart fuseki
Utils.restartFuseki();
log.debug("sleep (final)...........................");
// 일정시간을 대기 한다.(2차)
waitTime = 30*1000;
Thread.sleep(waitTime);
// 실행(2차)
log.debug("try (final).......................");
result = Utils.runShell(sb);
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
} else {
// pass
}
}
log.info("sendTripleFile to DW end==========================>");
return result;
}
/**
* triple파일 체크(Fuseki만)
* @param triple_path_file
* @param result_file_name
* @return String[]
* @throws Exception
*/
public String[] checkTripleFile(String triple_path_file, String result_file_name) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/bin/jena/apache-jena-3.0.0/bin/riot",
"--check", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
String result_path = Utils.getSdaProperty("com.pineone.icbms.sda.riot.result.save_path");
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.mode");;
args[2] = triple_path_file;
log.info("checkTripleFile start============================>");
log.debug("checkTripleFile ==============triple_path_file============>" + triple_path_file);
log.debug("result_path ==============result_path============>" + result_path);
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("checkTripleFile ==============args============>" + sb.toString());
//실행(1차)
log.debug("try (first)...........................");
result = Utils.runShell(sb);
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.checkTripleFile() == > "+ result[1]);
int waitTime = 15*1000;
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
log.debug("sleep (first)...........................");
// 일정시간을 대기 한다.(1차)
Thread.sleep(waitTime);
// restart fuseki
Utils.restartFuseki();
log.debug("sleep (final)...........................");
// 일정시간을 대기 한다.(2차)
waitTime = 30*1000;
Thread.sleep(waitTime);
// 실행(2차)
log.debug("try (final)...........................");
result = Utils.runShell(sb);
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
} else {
throw new UserDefinedException(HttpStatus.CONTINUE, result[1].toString());
}
}
log.info("checkTripleFile end==========================>");
return result;
}
public String[] sendTripleFile(String triple_path_file) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.sparql.endpoint");
args[2] = "default";
args[3] = triple_path_file;
log.info("sendTripleFile start==========================>");
log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);
// 개수확인(before)
Utils.getTripleCount();
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("sendTripleFile ==============args============>" + sb.toString());
// 실행
result = Utils.runShell(sb);
log.debug("resultStr in TripleService.sendTripleFile() == > "+ Arrays.toString(result));
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.sendTripleFile() == > "+ result[1]);
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
log.info("sendTripleFile end==========================>");
// 개수확인(after)
Utils.getTripleCount();
return result;
}
/**
* triple파일을 DW로 전송
* @param triple_path_file
* @throws Exception
* @return String[]
*/
public String[] sendTripleFileToDW(String triple_path_file) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/home/pineone/svc/apps/sda/bin/apache-jena-fuseki-2.3.0/bin/s-post",
"http://192.168.1.1:3030/icbms", "default", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.triple.regist.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dw.sparql.endpoint");
args[2] = "default";
args[3] = triple_path_file;
log.info("sendTripleFile to DW start==========================>");
log.debug("sendTripleFile ==============triple_path_file============>" + triple_path_file);
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("sendTripleFile ==============args============>" + sb.toString());
// 실행(1차)
log.debug("try (first).......................");
result = Utils.runShell(sb);
log.debug("resultStr in TripleService.sendTripleFileToDW() == > "+ Arrays.toString(result));
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.sendTripleFileToDW() == > "+ result[1]);
int waitTime = 15*1000;
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
log.debug("sleep (first)...........................");
// 일정시간을 대기 한다.(1차)
Thread.sleep(waitTime);
// restart fuseki
Utils.restartFuseki();
log.debug("sleep (final)...........................");
// 일정시간을 대기 한다.(2차)
waitTime = 30*1000;
Thread.sleep(waitTime);
// 실행(2차)
log.debug("try (final).......................");
result = Utils.runShell(sb);
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
} else {
// pass
}
}
log.info("sendTripleFile to DW end==========================>");
return result;
}
/**
* triple파일 체크(Fuseki만)
* @param triple_path_file
* @param result_file_name
* @return String[]
* @throws Exception
*/
public String[] checkTripleFile(String triple_path_file, String result_file_name) throws Exception {
String[] result = new String[]{"",""};
String[] args = { "/bin/jena/apache-jena-3.0.0/bin/riot",
"--check", "/tmp/test.nt" };
// conf값을 확인해서 재설정함
String result_path = Utils.getSdaProperty("com.pineone.icbms.sda.riot.result.save_path");
args[0] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.bin");
args[1] = Utils.getSdaProperty("com.pineone.icbms.sda.riot.mode");;
args[2] = triple_path_file;
log.info("checkTripleFile start============================>");
log.debug("checkTripleFile ==============triple_path_file============>" + triple_path_file);
log.debug("result_path ==============result_path============>" + result_path);
StringBuilder sb = new StringBuilder();
for (String str : args) {
sb.append(str);
sb.append(" ");
}
log.debug("checkTripleFile ==============args============>" + sb.toString());
//실행(1차)
log.debug("try (first)...........................");
result = Utils.runShell(sb);
if(result[1] == null || ! result[1].trim().equals("")) {
log.debug("result[1](error message) in TripleService.checkTripleFile() == > "+ result[1]);
int waitTime = 15*1000;
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
log.debug("sleep (first)...........................");
// 일정시간을 대기 한다.(1차)
Thread.sleep(waitTime);
// restart fuseki
Utils.restartFuseki();
log.debug("sleep (final)...........................");
// 일정시간을 대기 한다.(2차)
waitTime = 30*1000;
Thread.sleep(waitTime);
// 실행(2차)
log.debug("try (final)...........................");
result = Utils.runShell(sb);
if(result[1].contains("500 Server Error") || result[1].contains("java.net.ConnectException") || result[1].contains("Service Unavailable") ) {
throw new UserDefinedException(HttpStatus.GONE, result[1].toString());
}
} else {
throw new UserDefinedException(HttpStatus.CONTINUE, result[1].toString());
}
}
log.info("checkTripleFile end==========================>");
return result;
}