.equals(Product.STRUCTURE_HIERARCHICAL)) {
if (product.getProductReferences() == null
|| (product.getProductReferences() != null && product
.getProductReferences().size() == 0)) {
throw new VersioningException(
"Hierarchical product and references not set!");
}
// get the first reference, it tells us what directory to move it
// to
// TODO: fix that hack :-)
Reference r = (Reference) product.getProductReferences().get(0);
String dataStoreRef = null;
try {
dataStoreRef = new File(new URI(productRepoPath)).toURL()
.toExternalForm()
+ URLEncoder.encode(productName, "UTF-8") + "/";
LOG.log(Level.INFO, "BasicVersioner: generated DataStore ref: "
+ dataStoreRef + " from origRef: "
+ r.getOrigReference());
r.setDataStoreReference(dataStoreRef);
VersioningUtils.createBasicDataStoreRefsHierarchical(product
.getProductReferences());
} catch (URISyntaxException e) {
LOG.log(Level.WARNING,
"BasicVersioner: URISyntaxException while generating initial "
+ "data store ref for origRef: "
+ r.getOrigReference());
throw new VersioningException(e);
} catch (MalformedURLException e) {
LOG.log(Level.WARNING,
"BasicVersioner: MalformedURLException while generating initial "
+ "data store ref for origRef: "
+ r.getOrigReference());
throw new VersioningException(e);
} catch (UnsupportedEncodingException e) {
LOG.log(Level.WARNING,
"BasicVersioner: UnsupportedEncodingException while generating "
+ "initial data store ref for origRef: "
+ r.getOrigReference());
throw new VersioningException(e);
}
} else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
// just use the VersioningUtils
VersioningUtils.createBasicDataStoreRefsFlat(productName,
productRepoPath, product.getProductReferences());
} else {
throw new VersioningException("Unsupported product structure: "
+ product.getProductStructure());
}
}