FileDocCategorySizeDatePackage
AbstractDataContentHandler.javaAPI DocApache James 2.3.14266Fri Jan 12 12:56:34 GMT 2007org.apache.james.util.mail.handlers

AbstractDataContentHandler

public abstract class AbstractDataContentHandler extends Object implements DataContentHandler
Abstract class providing common Data Handler behavior.

Fields Summary
private ActivationDataFlavor
fieldDataFlavor
Constructors Summary
public AbstractDataContentHandler()
Default Constructor

        super();
    
Methods Summary
protected abstract java.lang.ObjectcomputeContent(javax.activation.DataSource aDataSource)
Compute the content from aDataSource.

param
aDataSource
return
new Content built from the DataSource
throws
MessagingException

protected abstract javax.activation.ActivationDataFlavorcomputeDataFlavor()
Compute an ActivationDataFlavor.

return
A new ActivationDataFlavor

public java.lang.ObjectgetContent(javax.activation.DataSource aDataSource)

see
javax.activation.DataContentHandler#getContent(javax.activation.DataSource)

        Object content = null;
        try
        {
            content = computeContent(aDataSource);
        }
        catch (MessagingException e)
        {
            // No-op
        }
        return content;
    
protected javax.activation.ActivationDataFlavorgetDataFlavor()
Get the DataFlavor, lazily initialised if required.

return
Returns the dataFlavor, lazily initialised.

        ActivationDataFlavor dataFlavor = null;
        if (null == (dataFlavor = getDataFlavorBasic()))
        {
            updateDataFlavor();
            return getDataFlavor();
        }
        return dataFlavor;
    
private javax.activation.ActivationDataFlavorgetDataFlavorBasic()
Get the DataFlavor.

return
Returns the dataFlavor.

        return fieldDataFlavor;
    
public java.lang.ObjectgetTransferData(java.awt.datatransfer.DataFlavor aDataFlavor, javax.activation.DataSource aDataSource)

see
javax.activation.DataContentHandler#getTransferData(java.awt.datatransfer.DataFlavor, javax.activation.DataSource)

        Object content = null;
        if (getDataFlavor().equals(aDataFlavor))
            content = getContent(aDataSource);
        return content;
    
public java.awt.datatransfer.DataFlavor[]getTransferDataFlavors()

see
javax.activation.DataContentHandler#getTransferDataFlavors()

        return new DataFlavor[]{getDataFlavor()};
    
protected voidsetDataFlavor(javax.activation.ActivationDataFlavor aDataFlavor)

        fieldDataFlavor = aDataFlavor;
    
protected voidupdateDataFlavor()
Update the current DataFlavor.

        setDataFlavor(computeDataFlavor());