Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] How to avoid LayerResource cache?

Hi Jesse; the CSV library I am using is "streaming" based .... ie I can get a single use API which I need to close after each use.

        CsvReader pr = null;
        try {
....
            if( resource instanceof LayerResource ){
resource = CatalogPlugin.getDefault().getLocalCatalog().getById(IGeoResource.class, resource.getIdentifier(), null );
            }
pr = resource.resolve(CsvReader.class, new SubProgressMonitor(monitor, 10) );
    ...
            }
        } catch (IOException e) {
throw new RenderException(e); // rethrow any exceptions encountered }
        finally {
            if( pr != null ) pr.close();
            monitor.done();
        }
Right now I had to do an amazing trick to find the real resource; the LayerResource would cache the instance being made and return it to me each time; even after I had already closed it.

Do you have any suggestions for this one? This is training material so ...
- I don't want to break out another class; I would like to use the CsvReader as provided - The catalog lookup shown above is a bit of a crazy hack; not sure I want to explain it to myself let alone others... - Is there a way to "turn off" LayerResource cache? Or only have it cache known things ...

Jody



Back to the top