use of org.apache.jackrabbit.webdav.DavResourceIteratorImpl in project jackrabbit by apache.
the class VersionHistoryResourceImpl method getMembers.
//--------------------------------------------------------< DavResource >---
/**
* Show all versions of this history as members.
*
* @return
* @see DavResource#getMembers()
*/
@Override
public DavResourceIterator getMembers() {
ArrayList<DavResource> list = new ArrayList<DavResource>();
if (exists() && isCollection()) {
try {
// only display versions as members of the vh. the jcr:versionLabels
// node is an internal structure.
VersionIterator it = ((VersionHistory) getNode()).getAllVersions();
while (it.hasNext()) {
// omit item filter here. if the version history is visible
// its versions should be visible as well.
Version v = it.nextVersion();
DavResourceLocator vhLocator = getLocator();
DavResourceLocator resourceLocator = vhLocator.getFactory().createResourceLocator(vhLocator.getPrefix(), vhLocator.getWorkspacePath(), v.getPath(), false);
DavResource childRes = getFactory().createResource(resourceLocator, getSession());
list.add(childRes);
}
} catch (RepositoryException e) {
// should not occur
log.error("Unexpected error", e);
} catch (DavException e) {
// should not occur
log.error("Unexpected error", e);
}
}
return new DavResourceIteratorImpl(list);
}
use of org.apache.jackrabbit.webdav.DavResourceIteratorImpl in project jackrabbit by apache.
the class DefaultItemCollection method getMembers.
/**
* @see org.apache.jackrabbit.webdav.DavResource#getMembers()
*/
@Override
public DavResourceIterator getMembers() {
ArrayList<DavResource> memberList = new ArrayList<DavResource>();
if (exists()) {
try {
Node n = (Node) item;
// add all node members
NodeIterator it = n.getNodes();
while (it.hasNext()) {
Node node = it.nextNode();
DavResourceLocator loc = getLocatorFromItem(node);
memberList.add(createResourceFromLocator(loc));
}
// add all property members
PropertyIterator propIt = n.getProperties();
while (propIt.hasNext()) {
Property prop = propIt.nextProperty();
DavResourceLocator loc = getLocatorFromItem(prop);
memberList.add(createResourceFromLocator(loc));
}
} catch (RepositoryException e) {
// ignore
log.error(e.getMessage());
} catch (DavException e) {
// should never occur.
log.error(e.getMessage());
}
}
return new DavResourceIteratorImpl(memberList);
}
use of org.apache.jackrabbit.webdav.DavResourceIteratorImpl in project jackrabbit by apache.
the class RootCollection method getMembers.
/**
* Returns an iterator over the member resources, which are all
* workspace resources available.
*
* @return members of this collection
* @see org.apache.jackrabbit.webdav.DavResource#getMembers()
*/
@Override
public DavResourceIterator getMembers() {
List<DavResource> memberList = new ArrayList();
try {
String[] wsNames = getRepositorySession().getWorkspace().getAccessibleWorkspaceNames();
for (String wsName : wsNames) {
String wspPath = "/" + wsName;
DavResourceLocator childLoc = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), wspPath, wspPath);
memberList.add(createResourceFromLocator(childLoc));
}
} catch (RepositoryException e) {
log.error(e.getMessage());
} catch (DavException e) {
// should never occur
log.error(e.getMessage());
}
return new DavResourceIteratorImpl(memberList);
}
use of org.apache.jackrabbit.webdav.DavResourceIteratorImpl in project jackrabbit by apache.
the class DavResourceImpl method getMembers.
/**
* @see DavResource#getMembers()
*/
public DavResourceIterator getMembers() {
ArrayList<DavResource> list = new ArrayList<DavResource>();
if (exists() && isCollection()) {
try {
NodeIterator it = node.getNodes();
while (it.hasNext()) {
Node n = it.nextNode();
if (!isFilteredItem(n)) {
DavResourceLocator resourceLocator = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), n.getPath(), false);
DavResource childRes = factory.createResource(resourceLocator, session);
list.add(childRes);
} else {
log.debug("Filtered resource '" + n.getName() + "'.");
}
}
} catch (RepositoryException e) {
// should not occur
} catch (DavException e) {
// should not occur
}
}
return new DavResourceIteratorImpl(list);
}
use of org.apache.jackrabbit.webdav.DavResourceIteratorImpl in project jackrabbit by apache.
the class WorkspaceResourceImpl method getMembers.
/**
* Returns the resource representing the JCR root node.
*
* @return
*/
@Override
public DavResourceIterator getMembers() {
try {
DavResourceLocator loc = getLocatorFromItem(getRepositorySession().getRootNode());
List<DavResource> list = Collections.singletonList(createResourceFromLocator(loc));
return new DavResourceIteratorImpl(list);
} catch (DavException e) {
log.error("Internal error while building resource for the root node.", e);
return DavResourceIteratorImpl.EMPTY;
} catch (RepositoryException e) {
log.error("Internal error while building resource for the root node.", e);
return DavResourceIteratorImpl.EMPTY;
}
}
Aggregations