Package org.apache.wiki.attachment

Examples of org.apache.wiki.attachment.Attachment


               
                CacheEntry e = aEvent.getEntry();
               
                if( e != null )
                {
                    Attachment item = (Attachment) e.getContent();

                    if( item != null )
                    {
                        m_allItems.remove( item.getName() );
                    }
                }
            }
        }
View Full Code Here


            if( log.isDebugEnabled() )
            {
                log.debug( "attachment cache entry updated: " + aEvent.getKey() );
            }

            Attachment item = (Attachment) aEvent.getEntry().getContent();

            if( item != null )
            {
                // Item added or replaced.
                m_allItems.put( item.getName(), item );
            }
            else
            {
                m_allItems.remove( aEvent.getKey() );
            }
View Full Code Here

                    }

                    Collection allAttachments = m_engine.getAttachmentManager().getAllAttachments();
                    for( Iterator iterator = allAttachments.iterator(); iterator.hasNext(); )
                    {
                        Attachment att = (Attachment) iterator.next();
                       
                        try
                        {
                            String text = getAttachmentContent( att.getName(), WikiProvider.LATEST_VERSION );
                            luceneIndexPage( att, text, writer );
                        }
                        catch( IOException e )
                        {
                            log.warn( "Unable to index attachment " + att.getName() + ", continuing to next", e );
                        }
                    }

                }
                finally
View Full Code Here

    {
        AttachmentManager mgr = m_engine.getAttachmentManager();

        try
        {
            Attachment att = mgr.getAttachmentInfo( attachmentName, version );
            //FIXME: Find out why sometimes att is null
            if(att != null)
            {
                return getAttachmentContent( att );
            }
View Full Code Here

            Collection attachments = m_engine.getAttachmentManager().listAttachments(page);
            String attachmentNames = "";

            for( Iterator it = attachments.iterator(); it.hasNext(); )
            {
                Attachment att = (Attachment) it.next();
                attachmentNames += att.getName() + ";";
            }
            field = new Field(LUCENE_ATTACHMENTS, attachmentNames,
                              Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO);
            doc.add( field );
View Full Code Here

            }

            StringBuffer attachmentNames = new StringBuffer();
            for( Iterator it = attachments.iterator(); it.hasNext(); )
            {
                Attachment att = (Attachment) it.next();
                attachmentNames.append(att.getName());
                if(it.hasNext())
                    attachmentNames.append(separator);
            }
            return attachmentNames.toString();
        }
View Full Code Here

                                //
                                continue;
                            }
                        }

                        Attachment att = getAttachmentInfo( page, attachmentName,
                                                            WikiProvider.LATEST_VERSION );

                        //
                        //  Sanity check - shouldn't really be happening, unless
                        //  you mess with the repository directly.
View Full Code Here

           
            Collection c = listAttachments( new WikiPage( m_engine, pageId ) );

            for( Iterator it = c.iterator(); it.hasNext(); )
            {
                Attachment att = (Attachment) it.next();

                if( att.getLastModified().after( timestamp ) )
                {
                    list.add( att );
                }
            }
        }
View Full Code Here

     {@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;
View Full Code Here

        {
            int latest = findLatestVersion( att );

            for( int i = latest; i >= 1; i-- )
            {
                Attachment a = getAttachmentInfo( new WikiPage( m_engine, att.getParentName() ),
                                                  att.getFileName(), i );

                if( a != null )
                {
                    list.add( a );
View Full Code Here

TOP

Related Classes of org.apache.wiki.attachment.Attachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.