Mercurial > hg > svcore
comparison rdf/PluginRDFDescription.cpp @ 468:70b333085952
* complete switching the code to use CachedFile -- now to tidy & fix the
remaining flaws...
author | Chris Cannam |
---|---|
date | Mon, 27 Oct 2008 20:29:55 +0000 |
parents | 93806ad9481e |
children | 0dc158c1a6c9 |
comparison
equal
deleted
inserted
replaced
467:c9b055f84326 | 468:70b333085952 |
---|---|
17 | 17 |
18 #include "PluginRDFIndexer.h" | 18 #include "PluginRDFIndexer.h" |
19 #include "SimpleSPARQLQuery.h" | 19 #include "SimpleSPARQLQuery.h" |
20 | 20 |
21 #include "data/fileio/FileSource.h" | 21 #include "data/fileio/FileSource.h" |
22 #include "data/fileio/CachedFile.h" | |
22 | 23 |
23 #include "base/Profiler.h" | 24 #include "base/Profiler.h" |
24 | 25 |
25 #include "plugin/PluginIdentifier.h" | 26 #include "plugin/PluginIdentifier.h" |
26 | 27 |
27 #include <iostream> | 28 #include <iostream> |
28 using std::cerr; | 29 using std::cerr; |
29 using std::endl; | 30 using std::endl; |
30 | 31 |
31 PluginRDFDescription::PluginRDFDescription(QString pluginId) : | 32 PluginRDFDescription::PluginRDFDescription(QString pluginId) : |
32 m_source(0), | 33 //!!! m_source(0), |
33 m_pluginId(pluginId), | 34 m_pluginId(pluginId), |
34 m_haveDescription(false) | 35 m_haveDescription(false) |
35 { | 36 { |
36 PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance(); | 37 PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance(); |
37 QString url = indexer->getDescriptionURLForPluginId(pluginId); | 38 QString url = indexer->getDescriptionURLForPluginId(pluginId); |
48 } | 49 } |
49 } | 50 } |
50 | 51 |
51 PluginRDFDescription::~PluginRDFDescription() | 52 PluginRDFDescription::~PluginRDFDescription() |
52 { | 53 { |
53 delete m_source; | 54 //!!! delete m_source; |
54 } | 55 } |
55 | 56 |
56 bool | 57 bool |
57 PluginRDFDescription::haveDescription() const | 58 PluginRDFDescription::haveDescription() const |
58 { | 59 { |
166 if (FileSource::isRemote(url) && | 167 if (FileSource::isRemote(url) && |
167 FileSource::canHandleScheme(url)) { | 168 FileSource::canHandleScheme(url)) { |
168 | 169 |
169 //!!! persistent with expiry | 170 //!!! persistent with expiry |
170 | 171 |
172 CachedFile cf(url); | |
173 if (!cf.isOK()) { | |
174 return false; | |
175 } | |
176 | |
177 local = QUrl::fromLocalFile(cf.getLocalFilename()).toString(); | |
178 /*!!! | |
171 m_source = new FileSource(url, 0, FileSource::PersistentCache); | 179 m_source = new FileSource(url, 0, FileSource::PersistentCache); |
172 | 180 |
173 if (!m_source->isAvailable()) { | 181 if (!m_source->isAvailable()) { |
174 delete m_source; | 182 delete m_source; |
175 m_source = 0; | 183 m_source = 0; |
176 return false; | 184 return false; |
177 } | 185 } |
178 m_source->waitForData(); | 186 m_source->waitForData(); |
179 local = QUrl::fromLocalFile(m_source->getLocalFilename()).toString(); | 187 local = QUrl::fromLocalFile(m_source->getLocalFilename()).toString(); |
188 */ | |
180 } | 189 } |
181 | 190 |
182 if (!indexMetadata(local, label)) success = false; | 191 if (!indexMetadata(local, label)) success = false; |
183 if (!indexOutputs(local, label)) success = false; | 192 if (!indexOutputs(local, label)) success = false; |
184 | 193 |