* {@inheritDoc}
*/
public Attachment getAttachmentInfo( WikiPage page, String name, int version )
throws ProviderException
{
Attachment att = new Attachment( m_engine, page.getName(), name );
File dir = findAttachmentDir( att );
if( !dir.exists() )
{
// log.debug("Attachment dir not found - thus no attachment can exist.");
return null;
}
if( version == WikiProvider.LATEST_VERSION )
{
version = findLatestVersion(att);
}
att.setVersion( version );
// Should attachment be cachable by the client (browser)?
if (m_disableCache != null)
{
Matcher matcher = m_disableCache.matcher(name);
if (matcher.matches())
{
att.setCacheable(false);
}
}
// System.out.println("Fetching info on version "+version);
try
{
Properties props = getPageProperties(att);
att.setAuthor( props.getProperty( version+".author" ) );
String changeNote = props.getProperty( version+".changenote" );
if( changeNote != null )
{
att.setAttribute(WikiPage.CHANGENOTE, changeNote);
}
File f = findFile( dir, att );
att.setSize( f.length() );
att.setLastModified( new Date(f.lastModified()) );
}
catch( FileNotFoundException e )
{
log.error( "Can't get attachment properties for " + att, e );
return null;