String authorityId = this.getUUID();
File authorityDir = this.getAuthorityDir(authorityId);
if (authorityDir.exists()) {
throw new StoreDuplicateEntryException("Authority exists already.");
}
FileAuthority authority = new FileAuthority(authorityDir);
try {
authority.internalSetAuthorityId(authorityId);
authority.internalSetNamespace(null);
authority.internalSetLocalAuthService(localAuthService);
authority.internalSetRefs(refs);
authority.internalSetServices(services);
} catch (IOException ex) {
throw new StoreInternalException(ex, "Cannot create rootauthority.");
}
// create subsegment
File subSegmentDir = this.getSubSegmentDir(parentAuthorityDir, subSegmentName);
if (subSegmentDir.exists()) {
throw new StoreDuplicateEntryException("Subsegment exists already.");
}
FileSubSegment subSegment = new FileSubSegment(subSegmentDir);
try {