use of org.mule.runtime.api.deployment.persistence.MulePolicyModelJsonSerializer in project mule by mulesoft.
the class PolicyFileBuilder method doGetCustomResources.
@Override
protected List<ZipResource> doGetCustomResources() {
final List<ZipResource> customResources = new LinkedList<>();
if (mulePolicyModel != null) {
final File jsonDescriptorFile = new File(getTempFolder(), META_INF + separator + MULE_ARTIFACT + separator + MULE_ARTIFACT_JSON_DESCRIPTOR);
jsonDescriptorFile.deleteOnExit();
String jsonDescriber = new MulePolicyModelJsonSerializer().serialize(mulePolicyModel);
try {
writeStringToFile(jsonDescriptorFile, jsonDescriber);
} catch (IOException e) {
throw new IllegalStateException("There was an issue generating the JSON file for " + this.getId(), e);
}
customResources.add(new ZipResource(jsonDescriptorFile.getAbsolutePath(), META_INF + "/" + MULE_ARTIFACT + "/" + MULE_ARTIFACT_JSON_DESCRIPTOR));
}
return customResources;
}
Aggregations