if( protectedDocuments != null ) {
staticDocuments = protectedDocuments.toDocumentSet();
return( staticDocuments );
}
MutableDocumentSet ndocs = new DefaultDocumentSet( 1031 );
if( staticDocumentPaths == null ) {
// no path defined: return all documents in the db
try {
getBroker().getAllXMLResources( ndocs );
} catch(final PermissionDeniedException pde) {
LOG.warn("Permission denied to read resource all resources" + pde.getMessage(), pde);
throw new XPathException("Permission denied to read resource all resources" + pde.getMessage(), pde);
}
} else {
DocumentImpl doc;
Collection collection;
for( int i = 0; i < staticDocumentPaths.length; i++ ) {
try {
collection = getBroker().getCollection( staticDocumentPaths[i] );
if( collection != null ) {
collection.allDocs( getBroker(), ndocs, true);
} else {
doc = getBroker().getXMLResource( staticDocumentPaths[i], Lock.READ_LOCK );
if( doc != null ) {
if( doc.getPermissions().validate(
getBroker().getSubject(), Permission.READ ) ) {
ndocs.add( doc );
}
doc.getUpdateLock().release( Lock.READ_LOCK );
}
}
}