Skip to main content

Question about DSMCCObject behavior on file updates

4 replies [Last post]
gkapp
Offline
Joined: 2011-06-28
Points: 0

Hi,

I've been able to upload a file to a carousel and then successfully download it and verify its contents using a DSMCCObject. However, after updating the contents of the file on the carousel, creating a new DSMCCObject and loading the data, it appears to contain the original file. I figured it's caching, so I tried DSMCCObject.setRetrievalMode(DSMCCObject.FROM_STREAM_ONLY);, but that didn't help. I noticed that in the OCAP 1.1.5 spec document that it says "setRetrievalMode(int) - SHALL be silently ignored". Is receiving the old contents of the file the correct expected behavior, and if so, is there an alternative solution to get the updated contents?

Cheers,

Garrett

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
greg80303
Offline
Joined: 2008-07-03
Points: 0

It is important to recognize the context of the spec reference you have quoted. You are referring to OCAP Section 13.3.8.2. This applies to applications that have been downloaded from a carousel and copied to a local storage medium on the device. Once the application is running from storage, any attempts by that application to access any of its files via the original object carousel transport using DSMCCObject will have the API restrictions defined in that section.

Can you clarify whether this context applies to the problem you described above?

G

gkapp
Offline
Joined: 2011-06-28
Points: 0

Just to give a better idea of whats happening, the code that is running on the STB looks something like this:

// Arbitrary file has been uploaded to carousel<br />ServiceDomain carousel = new ServiceDomain();<br />carousel.attach(new OcapLocator(&quot;ocap://n=&quot; + serviceName));<br />DSMCCObject dsmccObject = new DSMCCObject(carousel.getMountPoint, filename);

dsmccObject.synchronousLoad();<br />FileInputStream fis = new FileInputStream(dsmccObject);

// contents of file is read in from fis, crc is calculated

carousel.detach();

Thread.sleep(60000);  // During this time, file on carousel is updated with new contents

// At this point, the crc of the downloaded file matches what we expect<br />

When this code is run a second time, immediately afterwards (no reboot or anything in between - same application running), the crc matches the original upload, not the updated file's conents. With this code, should the new DSMCCObject be expected to have the old contents or the new contents, and if the old contents are what this code would result in, is there another way to get the new contents of the file on the carousel?

pmodem
Offline
Joined: 2008-12-17
Points: 0

This is the behavior based on RI implementation: When you open a file, it stays consistent on the version of the file you opened, even if it changes while you have it open. You will continue to read anything from the cache in that case.
Also, if you load a file on a DSMCCObject, and open a FileInputStream based on the loaded object, you will get the version that was in place when you loaded the file.
If you create a different DSMCCObject corresponding to the same path (or if you unload the DSMCCObject), you will get the current version that's on the carousel when you open the file.

Do you have a a listener registered with the DSMCCObject (dsmccObject.addObjectChangeListener(..))? Are you receiving notification that the file is changed?

Make sure the mpeenv.ini setting OC.CHECK.VERSION is set to 1 (TRUE). This should be on by default.

If it still does not work, please open an Issue tracker ticket and attach a detailed log so we can take look.

pmodem
Offline
Joined: 2008-12-17
Points: 0

RI fully supports version changes and there are no known issues in this area. Can you file an issue and attach a log with Java DEBUG logging enabled? We will take a look.