Menu

#5 Revise classes that handles Blobs, properties & metadata

open
None
5
2010-01-13
2009-10-31
No

Simplify creating a blob from this...
BlobProperties blobProperties = new BlobProperties(strBlobName);
FileStream stream = new FileStream(strFilePath);
BlobContents blobContents = new BlobContents(stream);
objBlobContainer.createBlob(blobProperties, blobContents, fOverwrite);

Be consistent with Blob Stream API terms and point of view (POV)

To put a blob into a container...
Blob objBlob = new Blob(strBlobName)
Stream objStream = FileStream(strFilePath);
objBlob.setContents(Stream objStream);
objBlob.setMetadata(Metadata objMetadata);
objBlobContainer.putBlob(objBlob, fOverwrite);

To get a blob from a container...
Blob objBlob = objBlobContainer.getBlob(strBlobName);
Stream objStream = objBlob.getContents();
Metadata objMetadata = objBlob.getMetadata();

Discussion

  • Yves YANG

    Yves YANG - 2009-11-02

    FYI

     
  • Yves YANG

    Yves YANG - 2009-11-02
    • assigned_to: nobody --> chuweihuang
     
  • chuwei huang

    chuwei huang - 2009-11-03

    At the moment, the java blob api is similar to c# blob api. Look at the c# example at
    http://www.dreamincode.net/code/snippet4222.htm about creating blob

     
  • jeff00seattle

    jeff00seattle - 2010-01-13

    Get rid classes that use the term *Properties: both ContainerProperties and
    BlobProperties.
    For Containers, there should be BlobContainer class (which encapsulates its
    property values (set/get) and has a Metadata (set/get))
    For Blobs, there should be a Blob class, which has (which encapsulates its
    property values (set/get) and has a Metadata (set/get) and has a
    BlobContent (set/get)).

    This is a cleaner OOD and much more inline with the Blob Service API.

     
  • jeff00seattle

    jeff00seattle - 2010-01-13
    • summary: Altering POV using Blob Stream API terms --> Provide intuitive handling for Blob properties & metadata
     
  • jeff00seattle

    jeff00seattle - 2010-01-13
    • summary: Provide intuitive handling for Blob properties & metadata --> Revise classes that handles Blobs, properties & metadata
     
  • jeff00seattle

    jeff00seattle - 2010-01-13

    To ease the burden upon BlobContainer class, there should be a Blob class.
    with:
    setMetadata(NameValueCollection)
    NameValueCollection getMetadata()
    byte[] getContents()
    setContents(byte[])

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.