Java SDK issues

Last post 05-01-2008 12:19 AM by brobergj. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-30-2008 3:57 AM

    Java SDK issues

    Does anyone actually use the Java SDK? Seems to be a few issues, to name a few:

    1. Seems to barf when using Application names with spaces in them.

    2. MasterAccount.java has compile errors (references methods that don't exist in Utilities.java)

    3. FileUploader.java thread implementation is strange... it is a thread itself, then spawns another thread for the actual upload?

    In the uploadFiles method it calls new Thread(this).start().

    This means if I use the following (very typical) code:

    ---------
    FileUploader fileUploader = session.getFileUploader(folder, this);
    fileUploader.uploadFiles(file);


    try {
    fileUploader.join();
    } catch (InterruptedException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    }
    ---------


    .. it will get unexpected results, because calling fileUploader.join()
    will return control at the end of the uploadFiles(file) method, when
    I really want the file to finish uploading first. This can be fixed by
    changing the last line in uploadFiles() to:


    // Start the thread to do the upload.
    //new Thread(this).start();
    this.start();


    4. While we are talking about uploading files, consider the use case where I
    just want to upload a single file and make it a public HostedItem, and
    get the public URL for that file. This is not very well supported.


    To upload a single file i have to do the following:
    -Create a File array with a single file in it.
    -Get a reference to the folder I want to put it in
    -Get a FileUploader reference, call fileUploader.uploadFiles(file);
    -Load the childen in the folder [folder.loadChildren(1, 500, FolderSortCode.CreatedDate, true);]
    -Iterate though all files in the folder until I find the file I just uploaded, so I can get the com.nirvanix.sdk.session.File reference
    -Call HostItem to get the list of hosted items
    -Iterate through the list of Hosted items until I find the file I just uploaded, and can call hostedItems[i].getFileURL()


    You really need the facility to upload a single file easily, and when
    you call HostItem() on a file, it should return a HostedItem reference
    instead of being a void method.


    5. The supplied javadoc in the zip doesnt match the code in many places. Regenerate it and see.
    Filed under:
  • 04-30-2008 8:50 PM In reply to

    • BarryR
    • Top 10 Contributor
    • Joined on 07-20-2007
    • San Diego
    • Posts 612

    Re: Java SDK issues

     I appreciate the time you put into this post.  We do have people using our Java SDK but generally they are silent customers who take the SDK and modify to their own tastes.  Since this is still a 1.X SDK we have a ways to go on usability as well as simplification. 

    brobergj:

    // Start the thread to do the upload.
    //new Thread(this).start();
    this.start();
     

    This is clearly an error, I noticed the same problem and have been updating the uploader to handle Partial File Uploads as well so we can do any size file uploads.  The additional topics you bring up for uploads are the simplification of the interface for single file uploads and working with the files after upload. 

    The version I will be releasing shortly contains a new method that will take in single files rather than an array as well as returning File objects for the files that were uploaded.

    brobergj:
    5. The supplied javadoc in the zip doesnt match the code in many places. Regenerate it and see
     

    Thank you for this report I will make sure the new javadoc is generated.

    I will try to address all of your concerns with the SDK release that is to be released soon.  I definitely appreciate your comments and would encourage any additional suggestions so we can improve usability, performance and the overall quality of the SDK.

    Thank you,
         Barry R.

    IM Support (Feel free to add me)

    MSN: barryruffner@msn.com
    Gmail: barryruffner@gmail.com
    Filed under: , ,
  • 05-01-2008 12:19 AM In reply to

    Re: Java SDK issues

    BarryR:
     I appreciate the time you put into this post.  We do have people using our Java SDK but generally they are silent customers who take the SDK and modify to their own tastes. 
    Indeed, and I have imported the SDK and made some small changes (like fixing the thread issue) myself. However, any customer that uses the SDK is likely to run into the exact same issues themselves, so it makes sense to address these issues in the base SDK - which I see you plan to do! I look forward to the new build. cheers James
Page 1 of 1 (3 items)