5 Replies Latest reply on Jul 2, 2009 3:37 AM by 843851

    saving a file in persistent

      Hi there,
      I am writing a client server applicaton for my diploma thesis where the server is Java and the client an Xlet.
      Now I need to save a file sent by the server via UDP datagram packet on the client side.
      I know the theory of persistent storage but how to use it in practise?
      Could somebody please support me with code how to save a FileOutputStream in the persistent storage area?

      thx a lot for all!
      best regards, Tobias
        • 1. Re: saving a file in persistent
          I was just too stupid ... :(

          here is the solution I found after long tries and research - if somebody will need it:
          // get root of the persistent storage
          String rootDir = System.getProperties().getProperty("dvb.persistent.root");
          // get oid/aid of this application
          String orgid = (String)context.getXletProperty("dvb.org.id");
          String appid = (String)context.getXletProperty("dvb.app.id");
          // build base file name for persistent storage
          String directory = rootDir+"/"+orgid+"/"+appid;
          hope it will be useful for somebody else!
          • 2. Re: saving a file in persistent
            Is this the way all OCAP applications obtain the path to write the persistent stoarge data?..One more question I had is where would the implementation store the downloaded storage applications(obviously not in persistent storage)...OCAP spec talks about some OCAP_LSV/Logical Storage Volume..Does implementation has to create one to store the downloaded application?
            Any feedback is welcome..as i'm in the learning mode
            • 3. Re: saving a file in persistent
              Hi Pallavi,

              Yes, this is how an OCAP app would store persistent file data, except that I would suggest using File.separator in place of "/" in the paths since that can vary from platform to platform.

              Where OCAP stores downloaded apps is up to the implementation, but it will not be where persistent files (as above) are stored. OCAP mandates that these be distinct, but allows the implementer flexibility beyond that.

              The app's directory structure, whether stored or no, is read-only to the application. If the application wants to write to the filesystem it must do that under the persistent storage root (as above). It also needs a Permission Request File that requests the file permission.

              Hope that answers your question?

              • 4. Re: saving a file in persistent
                Hi Anne..
                Thanks a lot..That answered my questions.
                • 5. Re: saving a file in persistent
                  I've one doubt regarding .perm file. To download and store an application whether monitor application should be of type 'storage' or 'registrar'. I am working with vidiom vision work bench it throws error for both. I am unable to get any kind of permissions from .perm file.