Package org.apache.wiki.attachment

Examples of org.apache.wiki.attachment.Attachment


    {
        if( m_beautifyTitle )
        {
            try
            {
                Attachment att = m_attachmentManager.getAttachmentInfo(title);

                if(att == null)
                {
                    return TextUtil.beautifyString( title );
                }

                String parent = TextUtil.beautifyString( att.getParentName() );

                return parent + "/" + att.getFileName();
            }
            catch( ProviderException e )
            {
                return title;
            }
View Full Code Here


     @param page WikiName of the page.
     *  @return true, if page (or attachment) exists.
     */
    public boolean pageExists( String page )
    {
        Attachment att = null;

        try
        {
            if( m_commandResolver.getSpecialPageReference(page) != null ) return true;

View Full Code Here

        {
            Collection atts = m_engine.getAttachmentManager().getAllAttachments();

            for( Iterator i = atts.iterator(); i.hasNext(); )
            {
                Attachment att = (Attachment)i.next();

                String pageName = att.getParentName();

                if( !pageNames.contains(pageName) )
                    pageNames.add( pageName );
            }
        }
View Full Code Here

            WikiPage page = m_engine.getPage( pageName );
            Collection attachments = m_engine.getAttachmentManager().listAttachments(page);

            for( Iterator i = attachments.iterator(); i.hasNext(); )
            {
                Attachment att = (Attachment) i.next();

                DavPath thisPath = new DavPath( "/" );

                thisPath.append( att.getName() );

                AttachmentItem ai = new AttachmentItem( this, thisPath, att );

                result.add( ai );
            }
View Full Code Here

        {
            String attName = path.getPath();

            try
            {
                Attachment att = m_engine.getAttachmentManager().getAttachmentInfo( attName );

                if( att != null )
                {
                    AttachmentItem ai = new AttachmentItem( this, path, att );
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

    }

    private String findAttachment( String linktext )
    {
        AttachmentManager mgr = m_engine.getAttachmentManager();
        Attachment att = null;

        try
        {
            att = mgr.getAttachmentInfo( m_context, linktext );
        }
        catch( ProviderException e )
        {
            log.warn("Finding attachments failed: ",e);
            return null;
        }

        if( att != null )
        {
            return att.getName();
        }
        else if( linktext.indexOf('/') != -1 )
        {
            return linktext;
        }
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.