public ContentLocation createLocation(final String name)
throws ContentCreationException
{
if (entries.containsKey(name))
{
throw new ContentCreationException("Entry already exists");
}
if (RepositoryUtilities.isInvalidPathName(name))
{
throw new ContentCreationException("Entry-Name is not valid");
}
final ZipContentLocation item = new ZipContentLocation(repository, this, name);
entries.put(name, item);
if ("/".equals(this.contentId) == false)
{
try
{
final ZipEntry entry = new ZipEntry(contentId + name + '/');
repository.writeDirectory(entry);
}
catch (IOException e)
{
throw new ContentCreationException("Failed to create directory.", e);
}
}
return item;
}