if (entity.getContentType().getValue().equals("application/java-archive")
|| entity.getContentType().getValue().equals("application/octet-stream")) {
// I have a jar/binary, potentially a resource
try {
if ((filter == null) || (url.matches(filter))) {
ResourceImpl resource = (ResourceImpl) new DataModelHelperImpl().createResource(new URL(url));
if (resource != null) {
LOGGER.debug("Copy {} into the Cave repository storage", url);
int index = url.lastIndexOf("/");
if (index > 0) {
url = url.substring(index);
}
File destination = new File(new File(this.getLocation()), url);
FileOutputStream outputStream = new FileOutputStream(destination);
entity.writeTo(outputStream);
outputStream.flush();
outputStream.close();
if (update) {
resource = (ResourceImpl) new DataModelHelperImpl().createResource(destination.toURI().toURL());
LOGGER.debug("Update OBR metadata with {}", resource.getId());
this.addResource(resource);
}
}
}