protected PlexusIoResourceCollection asResourceCollection( final ArchivedFileSet fileSet )
throws ArchiverException
{
final File archiveFile = fileSet.getArchive();
final PlexusIoResourceCollection resources;
try
{
resources = archiverManager.getResourceCollection( archiveFile );
}
catch ( final NoSuchArchiverException e )
{
throw new ArchiverException(
"Error adding archived file-set. PlexusIoResourceCollection not found for: " + archiveFile, e );
}
if ( resources instanceof PlexusIoArchivedResourceCollection )
{
( (PlexusIoArchivedResourceCollection) resources ).setFile( fileSet.getArchive() );
}
else
{
throw new ArchiverException( "Expected " + PlexusIoArchivedResourceCollection.class.getName() + ", got "
+ resources.getClass().getName() );
}
final PlexusIoProxyResourceCollection proxy = new PlexusIoProxyResourceCollection();
proxy.setSrc( resources );