NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, "/policytypes", toJson(body));\r
}\r
try {\r
+ mutex.acquire();\r
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.createPolicyType(body);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelRuntimeException pfme) {\r
final var msg = "POST /policytypes";\r
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
+ } catch (InterruptedException e) {\r
+ Thread.currentThread().interrupt();\r
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);\r
+ } finally {\r
+ mutex.release();\r
}\r
}\r
\r
String versionId,\r
UUID requestId) {\r
try {\r
+ mutex.acquire();\r
ToscaServiceTemplate serviceTemplate =\r
toscaServiceTemplateService.deletePolicyType(policyTypeId, versionId);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelRuntimeException pfme) {\r
var msg = String.format("DELETE /policytypes/%s/versions/%s", policyTypeId, versionId);\r
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
+ } catch (InterruptedException e) {\r
+ Thread.currentThread().interrupt();\r
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);\r
+ } finally {\r
+ mutex.release();\r
}\r
}\r
\r
"/policytypes/" + policyTypeId + "/versions/" + policyTypeVersion + "/policies", toJson(body));\r
}\r
try {\r
+ mutex.acquire();\r
ToscaServiceTemplate serviceTemplate =\r
toscaServiceTemplateService.createPolicy(policyTypeId, policyTypeVersion, body);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelRuntimeException pfme) {\r
var msg = String.format("POST /policytypes/%s/versions/%s/policies", policyTypeId, policyTypeVersion);\r
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
+ } catch (InterruptedException e) {\r
+ Thread.currentThread().interrupt();\r
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);\r
+ } finally {\r
+ mutex.release();\r
}\r
}\r
\r
String policyVersion,\r
UUID requestId) {\r
try {\r
+ mutex.acquire();\r
ToscaServiceTemplate serviceTemplate =\r
toscaServiceTemplateService.deletePolicy(policyTypeId, policyTypeVersion, policyId, policyVersion);\r
return makeOkResponse(requestId, serviceTemplate);\r
var msg = String.format("DELETE /policytypes/%s/versions/%s/policies/%s/versions/%s",\r
policyTypeId, policyTypeVersion, policyId, policyVersion);\r
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
+ } catch (InterruptedException e) {\r
+ Thread.currentThread().interrupt();\r
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);\r
+ } finally {\r
+ mutex.release();\r
}\r
}\r
\r
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, "/policies", toJson(body));\r
}\r
try {\r
+ mutex.acquire();\r
ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.createPolicies(body);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelRuntimeException pfme) {\r
final var msg = "POST /policies";\r
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
+ } catch (InterruptedException e) {\r
+ Thread.currentThread().interrupt();\r
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);\r
+ } finally {\r
+ mutex.release();\r
}\r
}\r
\r
String policyVersion,\r
UUID requestId) {\r
try {\r
+ mutex.acquire();\r
ToscaServiceTemplate serviceTemplate =\r
toscaServiceTemplateService.deletePolicy(null, null, policyId, policyVersion);\r
return makeOkResponse(requestId, serviceTemplate);\r
} catch (PfModelRuntimeException pfme) {\r
var msg = String.format("DELETE /policies/%s/versions/%s", policyId, policyVersion);\r
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
+ } catch (InterruptedException e) {\r
+ Thread.currentThread().interrupt();\r
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);\r
+ } finally {\r
+ mutex.release();\r
}\r
}\r
}\r
toJson(body));
}
try {
+ mutex.acquire();
ToscaServiceTemplate nodeTemplates = toscaServiceTemplateService.createToscaNodeTemplates(body);
return makeOkResponse(requestId, nodeTemplates);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = "POST /nodetemplates";
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);
+ } finally {
+ mutex.release();
}
}
toJson(body));
}
try {
+ mutex.acquire();
ToscaServiceTemplate nodeTemplates = toscaServiceTemplateService.updateToscaNodeTemplates(body);
return makeOkResponse(requestId, nodeTemplates);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = "PUT /nodetemplates";
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);
+ } finally {
+ mutex.release();
}
}
@Override
public ResponseEntity<ToscaServiceTemplate> deleteToscaNodeTemplates(String name, String version, UUID requestId) {
try {
+ mutex.acquire();
ToscaServiceTemplate nodeTemplates = toscaServiceTemplateService.deleteToscaNodeTemplate(name, version);
return makeOkResponse(requestId, nodeTemplates);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = String.format("DELETE /nodetemplates/%s/versions/%s", name, version);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);
+ } finally {
+ mutex.release();
}
}