001    package org.tynamo.blob;
002    
003    import org.apache.tapestry5.internal.services.AbstractAsset;
004    import org.apache.tapestry5.ioc.Resource;
005    import org.tynamo.descriptor.TynamoPropertyDescriptor;
006    
007    import java.io.InputStream;
008    import java.io.Serializable;
009    
010    /**
011     * An implementation of {@link AbstractAsset} for assets that are entity properties.
012     */
013    public class BlobAsset extends AbstractAsset
014    {
015    
016            private BlobDownloadService bytesService;
017    
018            private Serializable id;
019    
020            private TynamoPropertyDescriptor propertyDescriptor;
021    
022            public BlobAsset(boolean invariant)
023            {
024                    super(invariant);
025            }
026    
027            public BlobAsset(BlobDownloadService chartService, TynamoPropertyDescriptor propertyDescriptor,
028                                             Serializable id)
029            {
030                    super(false);
031                    this.bytesService = chartService;
032                    this.id = id;
033                    this.propertyDescriptor = propertyDescriptor;
034            }
035    
036            public TynamoPropertyDescriptor getPropertyDescriptor()
037            {
038                    return propertyDescriptor;
039            }
040    
041            public Serializable getId()
042            {
043                    return id;
044            }
045    
046            public String buildURL()
047            {
048    /*
049                    Link l = bytesService.getLink(false, new Object[]{this});
050                    return l.toAbsoluteURI();
051    */
052                    return null;
053            }
054    
055            public InputStream getResourceAsStream()
056            {
057                    return null;
058            }
059    
060            public String toClientURL()
061            {
062                    return null;  //To change body of implemented methods use File | Settings | File Templates.
063            }
064    
065            public Resource getResource()
066            {
067                    return null;  //To change body of implemented methods use File | Settings | File Templates.
068            }
069    }