org.apache.jackrabbit.webdav.DavResourceIteratorImpl Java Examples

The following examples show how to use org.apache.jackrabbit.webdav.DavResourceIteratorImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DavHomeCollection.java    From cosmo with Apache License 2.0 6 votes vote down vote up
@Override
public DavResourceIterator getCollectionMembers() {
    List<org.apache.jackrabbit.webdav.DavResource> members = new ArrayList<org.apache.jackrabbit.webdav.DavResource>();
    try {
        Set<CollectionItem> collectionItems = getContentService().findCollectionItems((CollectionItem) getItem());
        for (Item memberItem : collectionItems) {
            WebDavResource resource = memberToResource(memberItem);
            if (resource != null) {
                members.add(resource);
            }
        }

        // for now scheduling is an option
        if (isSchedulingEnabled()) {
            members.add(memberToResource(
                    TEMPLATE_USER_INBOX.bindAbsolute(getResourceLocator().getBaseHref(), getResourcePath())));
            members.add(memberToResource(
                    TEMPLATE_USER_OUTBOX.bindAbsolute(getResourceLocator().getBaseHref(), getResourcePath())));
        }

    } catch (CosmoDavException e) {
        throw new CosmoException(e);
    }
    return new DavResourceIteratorImpl(members);
}
 
Example #2
Source File: ArchivaDavResource.java    From archiva with Apache License 2.0 6 votes vote down vote up
@Override
public DavResourceIterator getMembers()
{
    List<DavResource> list;
    if ( exists() && isCollection() )
    {
        list = asset.list().stream().filter( m -> !m.getName().startsWith( HIDDEN_PATH_PREFIX ) )
            .map(m -> {
                String path = locator.getResourcePath( ) + '/' + m.getName();
                DavResourceLocator resourceLocator =
                    locator.getFactory( ).createResourceLocator( locator.getPrefix( ), path );
                try
                {
                    return factory.createResource( resourceLocator, session );
                }
                catch ( DavException e )
                {
                    return null;
                }

            }).filter( Objects::nonNull ).collect( Collectors.toList());
    } else {
        list = Collections.emptyList( );
    }
    return new DavResourceIteratorImpl( list );
}
 
Example #3
Source File: DavUserPrincipal.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public DavResourceIterator getMembers() {
    /*
     * While it would be ideal to throw an UnsupportedOperationException, MultiStatus tries to add a
     * MultiStatusResponse for every member of a WebDavResource regardless of whether or not it's a collection, so
     * we need to return an empty iterator.
     */
    return new DavResourceIteratorImpl(Collections.emptyList());
}
 
Example #4
Source File: DavContentBase.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public DavResourceIterator getMembers() {
    // while it would be ideal to throw an UnsupportedOperationException,
    // MultiStatus tries to add a MultiStatusResponse for every member
    // of a WebDavResource regardless of whether or not it's a collection,
    // so we need to return an empty iterator.
    return new DavResourceIteratorImpl(new ArrayList<DavResource>());
}
 
Example #5
Source File: DavCollectionBase.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public DavResourceIterator getMembers() {
    try {
        for (Item memberItem : ((CollectionItem) getItem()).getChildren()) {
            WebDavResource resource = memberToResource(memberItem);
            if (resource != null) {
                members.add(resource);
            }
        }

        return new DavResourceIteratorImpl(members);
    } catch (CosmoDavException e) {
        throw new CosmoException(e);
    }
}
 
Example #6
Source File: DavCollectionBase.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public DavResourceIterator getCollectionMembers() {
    try {
        Set<CollectionItem> collectionItems = getContentService().findCollectionItems((CollectionItem) getItem());
        for (Item memberItem : collectionItems) {
            WebDavResource resource = memberToResource(memberItem);
            if (resource != null) {
                members.add(resource);
            }
        }
        return new DavResourceIteratorImpl(members);
    } catch (CosmoDavException e) {
        throw new CosmoException(e);
    }
}
 
Example #7
Source File: DavHomeCollection.java    From cosmo with Apache License 2.0 5 votes vote down vote up
@Override
public DavResourceIterator getMembers() {
    List<org.apache.jackrabbit.webdav.DavResource> members = new ArrayList<org.apache.jackrabbit.webdav.DavResource>();
    try {
        for (Item memberItem : ((CollectionItem) getItem()).getChildren()) {
            WebDavResource resource = memberToResource(memberItem);
            if (resource != null) {
                members.add(resource);
            }
        }

        // for now scheduling is an option
        if (isSchedulingEnabled()) {
            members.add(memberToResource(
                    TEMPLATE_USER_INBOX.bindAbsolute(getResourceLocator().getBaseHref(), getResourcePath())));
            members.add(memberToResource(
                    TEMPLATE_USER_OUTBOX.bindAbsolute(getResourceLocator().getBaseHref(), getResourcePath())));
        }

        if (LOG.isTraceEnabled()) {
            LOG.trace("Members of Home Collection: {}", members.toString());
        }
        return new DavResourceIteratorImpl(members);
    } catch (CosmoDavException e) {
        throw new CosmoException(e);
    }
}
 
Example #8
Source File: DavInboxCollection.java    From cosmo with Apache License 2.0 5 votes vote down vote up
public DavResourceIterator getMembers() {
    // while it would be ideal to throw an UnsupportedOperationException,
    // MultiStatus tries to add a MultiStatusResponse for every member
    // of a WebDavResource regardless of whether or not it's a collection,
    // so we need to return an empty iterator.
    return DavResourceIteratorImpl.EMPTY;
}
 
Example #9
Source File: VersionHistoryResourceImpl.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public DavResourceIterator getMembers() {
	ArrayList list = new ArrayList();
	return new DavResourceIteratorImpl(list);
}
 
Example #10
Source File: VersionResourceImpl.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public DavResourceIterator getMembers() {
    return new DavResourceIteratorImpl(Collections.EMPTY_LIST);
}
 
Example #11
Source File: DavUserPrincipalCollection.java    From cosmo with Apache License 2.0 4 votes vote down vote up
public DavResourceIterator getMembers() {        
    // Return an empty list to also support PROPFIND with depth 1 and depth infinity.
    return new DavResourceIteratorImpl(Collections.emptyList());
}
 
Example #12
Source File: DavOutboxCollection.java    From cosmo with Apache License 2.0 4 votes vote down vote up
public DavResourceIterator getMembers() {
    return DavResourceIteratorImpl.EMPTY;
}
 
Example #13
Source File: DavOutboxCollection.java    From cosmo with Apache License 2.0 4 votes vote down vote up
@Override
public DavResourceIterator getCollectionMembers() {
    return DavResourceIteratorImpl.EMPTY;
}
 
Example #14
Source File: DavInboxCollection.java    From cosmo with Apache License 2.0 4 votes vote down vote up
@Override
public DavResourceIterator getCollectionMembers() {
    return DavResourceIteratorImpl.EMPTY;
}