World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Feature Discussion

Feature Discussion Education, discussion and proposals of WWJ features

Reply
 
Thread Tools Display Modes
Old 09-18-2012, 08:11 PM   #1
TheGypsy
Junior Member
 
Join Date: May 2008
Posts: 4
TheGypsy is on a distinguished road
Default Cache directory on Windows should not be in the roaming profile

Hello,

The configuration key "gov.nasa.worldwind.platform.user.store" used to configure FileStores maps to the "\\Application Data" folder on Windows (this is hardcoded in the AbstractFileStore class in 1.4).

On Windows XP and Windows 7, this is the roaming profile (for example on Windows 7, this maps to "C:\Users\johndoe\AppData\Roaming\WorldW indData"), meant to move with you as you log into another computer in a corporate environment, so this is clearly not the best place to store hundreds of megabytes of cache data.

It would be nice if:
  • we could override the default behaviour (the determineSingleUserLocation() method is currently static)
  • or if the default behaviour could map directly to the right directory.

I know the second option is quite complex (XP and 7 do not use the same folders, and in corporate environment, directories could even be mapped somewhere else), the best way is to use JNA like this:
Code:
Shell32Util.getFolderPath( ShlObj.CSIDL_LOCAL_APPDATA )
It is only one line of code to get things right, but it would add another dependency on Worldwind just for this, so maybe the first option is the best one.

Thanks!
TheGypsy is offline   Reply With Quote
Old 09-19-2012, 01:47 AM   #2
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,617
nlneilson is on a distinguished road
Default

\src\config\DataFileStore.xml
You can specify where the cache will be.

I don't see a need to have a key in the core code as the .xml file is external
and can be changed to whatever a user wants.

I do it like this, it works on win and ubuntu or even with the WWJ and C++ apps and cache on a 32GB micro SD card, external hd, usb memory, probably even a peanut butter sandwich if you can get a computer to read it.

Code:
<?xml version="1.0"?>
<dataFileStore>
    <readLocations>
        <location wwDir="..\NLNwwData"/>
        <location wwDir="../NLNwwData"/>
	</readLocations>
    <writeLocations>
        <location wwDir="..\NLNwwData" create="true"/>
        <location wwDir="../NLNwwData" create="true"/>
        <location property="java.io.tmpdir" wwDir="NLNwwData" create="true"/>		
    </writeLocations>
</dataFileStore>
When running in Linux just on the hd it is changed a bit to read/write on the Win cache.
On 64bit the 64bit jogl files are in another directory with the WWJ app but it could set with
-Djava.library.path=. in a .bat or .bash file.

You should be able to place the cache anywhere on the lan the computers can get to it.

Also look at \src\config\worldwind.xml
<Property name="gov.nasa.worldwind.avkey.DataFileS toreConfigurationFileName" value="config/DataFileStore.xml"/>
You can set whatever .xml file you want to set your cache location, that is a key you can use.

Quote:
Originally Posted by TheGypsy View Post
... hundreds of megabytes of cache data.
Just my FAA charts are over 3.3GB and that is after switching from .dds to .jpg
After deleting ~5GB of VE .dds data the cache is about 10GB.
You will end up with several GB of data at least.

You registered a while back so welcome to WWJ posting.

The "Search" function on the forum and the java.docs are a great help.
__________________
Neil
http://www.nlneilson.com

Last edited by nlneilson; 09-19-2012 at 03:21 AM.
nlneilson is offline   Reply With Quote
Old 09-24-2012, 08:07 PM   #3
TheGypsy
Junior Member
 
Join Date: May 2008
Posts: 4
TheGypsy is on a distinguished road
Default

Well, I was trying to put the cache folder somewhere predictable, independently of the location of my Worldwind-based application.
Note that this application could very well be in some read-only directory (like c:\program files), so relative path as shown in your example would not work. The temp directory would work, but it could be flushed on the next reboot (I cannot change group policies).
The natural solution would be to store the cache folder into the standard folder for application data, and WorldWind provides an API for this, but its implementation on Windows OS is not exactly what it should be (just look at how the determineSingleUserLocation() method is implemented if you have a doubt, it looks like it was a quick workaround).

Anyway, I have found this solution to be working for me: I do not declare any location in the dataFileStore xml node, and I call WorldWind.getFileStore().addLocation( ... ) with the directory I want to use at startup.

PS: yes I registered a looong time ago, while testing some early version of WW, then I did something completely different for a few years, and I recently came back with 1.4. I must say there are a lot of nice new features, but you still have to copy-paste a lot of code if you want to customize some very simple features, because key methods are often not overridable... (without modifying the WW codebase of course)
TheGypsy is offline   Reply With Quote
Old 09-25-2012, 07:35 AM   #4
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,617
nlneilson is on a distinguished road
Default

Quote:
Originally Posted by TheGypsy View Post
Well, I was trying to put the cache folder somewhere predictable, independently of the location of my Worldwind-based application.

Anyway, I have found this solution to be working for me: I do not declare any location in the dataFileStore xml node, and I call WorldWind.getFileStore().addLocation( ... ) with the directory I want to use at startup.

... but you still have to copy-paste a lot of code if you want to customize some very simple features, because key methods are often not overridable... (without modifying the WW codebase of course)
It's good you got something working.
The example posted seemed to work best on removabe media.
Wherever the cache is and can be read the DataFileStore.xml can specify where it is. Like running a WWJ app on Linux and using the cache on Win:
<location wwDir="/host/NLN/WWData"/>

"... and I call WorldWind.getFileStore().addLocation( ... ) with the directory ..." Well good for you. I like to have a link where anyone just needs to click on it.

"... because key methods are often not overridable ..."
There have been some where that has been changed.
Usually there is a workaround.
If you have a specific instance you can post it but a "Search" in the forum will usually find an answer.
__________________
Neil
http://www.nlneilson.com
nlneilson is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting cache directory in Java nigel_ht Development Help 4 05-30-2012 10:09 PM
SQUID configuration to cache WMS server responses garakl Server Discussion 1 08-08-2011 02:16 PM
installation puts shortcuts in the current user profile rpremuz Bug Reports 4 05-27-2010 04:52 PM
what is the cache directory for WWJ? tieshu Development Help 2 07-09-2009 02:46 PM
WWJ Cache directory structure gstew77 Development Help 1 12-05-2007 09:36 PM


All times are GMT +1. The time now is 09:43 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.