class WirisPlugin::FileStorageAndCache
Attributes
config[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 13 def initialize() super() end
Public Instance Methods
codeDigest(content)
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 19 def codeDigest(content) formula = getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER) digest = Md5Tools::encodeString(content) store = Store::newStoreWithParent(Store::newStore(formula),digest + ".ini") store::write(content) return digest end
decodeDigest(digest)
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 26 def decodeDigest(digest) formula = getAndCheckFolder(ConfigurationKeys::FORMULA_FOLDER) store = Store::newStoreWithParent(Store::newStore(formula),digest + ".ini") return store::read() end
deleteCache()
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 57 def deleteCache() end
getAndCheckFolder(key)
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 44 def getAndCheckFolder(key) folder = PropertiesTools::getProperty(@config,key) if (folder == nil) || (folder::trim()::length() == 0) raise Exception,"Missing configuration value: " + key end return folder end
getExtension(service)
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 51 def getExtension(service) if (service == "png") return ".png" end return ("." + service) + ".txt" end
init(obj, config, cache, cacheFormula)
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 16 def init(obj, config, cache, cacheFormula) self.config = config end
retreiveData(digest, service)
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 31 def retreiveData(digest, service) formula = getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER) store = Store::newStoreWithParent(Store::newStore(formula),digest + getExtension(service)) if !store::exists() return nil end return store::readBinary()::getData() end
storeData(digest, service, stream)
click to toggle source
# File lib/com/wiris/plugin/impl/FileStorageAndCache.rb, line 39 def storeData(digest, service, stream) formula = getAndCheckFolder(ConfigurationKeys::CACHE_FOLDER) store = Store::newStoreWithParent(Store::newStore(formula),digest + getExtension(service)) store::writeBinary(Bytes::ofData(stream)) end