Search in sources :

Example 1 with Cache

use of net.runelite.http.api.cache.Cache in project runelite by runelite.

the class CacheController method listArchives.

@RequestMapping("{cacheId}/{indexId}")
public List<CacheArchive> listArchives(@PathVariable int cacheId, @PathVariable int indexId) {
    CacheEntry cache = cacheService.findCache(cacheId);
    if (cache == null) {
        throw new NotFoundException();
    }
    IndexEntry indexEntry = cacheService.findIndexForCache(cache, indexId);
    if (indexEntry == null) {
        throw new NotFoundException();
    }
    List<ArchiveEntry> archives = cacheService.findArchivesForIndex(indexEntry);
    return archives.stream().map(archive -> new CacheArchive(archive.getArchiveId(), archive.getNameHash(), archive.getRevision())).collect(Collectors.toList());
}
Also used : PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) TextureProvider(net.runelite.cache.definitions.providers.TextureProvider) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) Cache(net.runelite.http.api.cache.Cache) SpriteDefinition(net.runelite.cache.definitions.SpriteDefinition) SpriteLoader(net.runelite.cache.definitions.loaders.SpriteLoader) IndexEntry(net.runelite.http.service.cache.beans.IndexEntry) ImageIO(javax.imageio.ImageIO) CacheEntry(net.runelite.http.service.cache.beans.CacheEntry) ItemLoader(net.runelite.cache.definitions.loaders.ItemLoader) FSFile(net.runelite.cache.fs.FSFile) IndexType(net.runelite.cache.IndexType) ObjectDefinition(net.runelite.cache.definitions.ObjectDefinition) TextureDefinition(net.runelite.cache.definitions.TextureDefinition) TextureLoader(net.runelite.cache.definitions.loaders.TextureLoader) NpcLoader(net.runelite.cache.definitions.loaders.NpcLoader) BufferedImage(java.awt.image.BufferedImage) ArchiveEntry(net.runelite.http.service.cache.beans.ArchiveEntry) Container(net.runelite.cache.fs.Container) IOException(java.io.IOException) ObjectLoader(net.runelite.cache.definitions.loaders.ObjectLoader) Collectors(java.util.stream.Collectors) RestController(org.springframework.web.bind.annotation.RestController) SpriteProvider(net.runelite.cache.definitions.providers.SpriteProvider) CacheIndex(net.runelite.http.api.cache.CacheIndex) CacheArchive(net.runelite.http.api.cache.CacheArchive) ConfigType(net.runelite.cache.ConfigType) ItemProvider(net.runelite.cache.definitions.providers.ItemProvider) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) ItemDefinition(net.runelite.cache.definitions.ItemDefinition) ItemSpriteFactory(net.runelite.cache.item.ItemSpriteFactory) NotFoundException(net.runelite.http.service.util.exception.NotFoundException) NpcDefinition(net.runelite.cache.definitions.NpcDefinition) ResponseEntity(org.springframework.http.ResponseEntity) ModelLoader(net.runelite.cache.definitions.loaders.ModelLoader) ModelProvider(net.runelite.cache.definitions.providers.ModelProvider) ModelDefinition(net.runelite.cache.definitions.ModelDefinition) CacheArchive(net.runelite.http.api.cache.CacheArchive) NotFoundException(net.runelite.http.service.util.exception.NotFoundException) IndexEntry(net.runelite.http.service.cache.beans.IndexEntry) ArchiveEntry(net.runelite.http.service.cache.beans.ArchiveEntry) CacheEntry(net.runelite.http.service.cache.beans.CacheEntry) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with Cache

use of net.runelite.http.api.cache.Cache in project runelite by runelite.

the class CacheController method listIndexes.

@RequestMapping("{cacheId}")
public List<CacheIndex> listIndexes(@PathVariable int cacheId) {
    CacheEntry cache = cacheService.findCache(cacheId);
    if (cache == null) {
        throw new NotFoundException();
    }
    List<IndexEntry> indexes = cacheService.findIndexesForCache(cache);
    return indexes.stream().map(entry -> new CacheIndex(entry.getIndexId(), entry.getRevision())).collect(Collectors.toList());
}
Also used : PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) TextureProvider(net.runelite.cache.definitions.providers.TextureProvider) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) Cache(net.runelite.http.api.cache.Cache) SpriteDefinition(net.runelite.cache.definitions.SpriteDefinition) SpriteLoader(net.runelite.cache.definitions.loaders.SpriteLoader) IndexEntry(net.runelite.http.service.cache.beans.IndexEntry) ImageIO(javax.imageio.ImageIO) CacheEntry(net.runelite.http.service.cache.beans.CacheEntry) ItemLoader(net.runelite.cache.definitions.loaders.ItemLoader) FSFile(net.runelite.cache.fs.FSFile) IndexType(net.runelite.cache.IndexType) ObjectDefinition(net.runelite.cache.definitions.ObjectDefinition) TextureDefinition(net.runelite.cache.definitions.TextureDefinition) TextureLoader(net.runelite.cache.definitions.loaders.TextureLoader) NpcLoader(net.runelite.cache.definitions.loaders.NpcLoader) BufferedImage(java.awt.image.BufferedImage) ArchiveEntry(net.runelite.http.service.cache.beans.ArchiveEntry) Container(net.runelite.cache.fs.Container) IOException(java.io.IOException) ObjectLoader(net.runelite.cache.definitions.loaders.ObjectLoader) Collectors(java.util.stream.Collectors) RestController(org.springframework.web.bind.annotation.RestController) SpriteProvider(net.runelite.cache.definitions.providers.SpriteProvider) CacheIndex(net.runelite.http.api.cache.CacheIndex) CacheArchive(net.runelite.http.api.cache.CacheArchive) ConfigType(net.runelite.cache.ConfigType) ItemProvider(net.runelite.cache.definitions.providers.ItemProvider) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) ItemDefinition(net.runelite.cache.definitions.ItemDefinition) ItemSpriteFactory(net.runelite.cache.item.ItemSpriteFactory) NotFoundException(net.runelite.http.service.util.exception.NotFoundException) NpcDefinition(net.runelite.cache.definitions.NpcDefinition) ResponseEntity(org.springframework.http.ResponseEntity) ModelLoader(net.runelite.cache.definitions.loaders.ModelLoader) ModelProvider(net.runelite.cache.definitions.providers.ModelProvider) ModelDefinition(net.runelite.cache.definitions.ModelDefinition) CacheIndex(net.runelite.http.api.cache.CacheIndex) NotFoundException(net.runelite.http.service.util.exception.NotFoundException) IndexEntry(net.runelite.http.service.cache.beans.IndexEntry) CacheEntry(net.runelite.http.service.cache.beans.CacheEntry) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

BufferedImage (java.awt.image.BufferedImage)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 ImageIO (javax.imageio.ImageIO)2 Slf4j (lombok.extern.slf4j.Slf4j)2 ConfigType (net.runelite.cache.ConfigType)2 IndexType (net.runelite.cache.IndexType)2 ItemDefinition (net.runelite.cache.definitions.ItemDefinition)2 ModelDefinition (net.runelite.cache.definitions.ModelDefinition)2 NpcDefinition (net.runelite.cache.definitions.NpcDefinition)2 ObjectDefinition (net.runelite.cache.definitions.ObjectDefinition)2 SpriteDefinition (net.runelite.cache.definitions.SpriteDefinition)2 TextureDefinition (net.runelite.cache.definitions.TextureDefinition)2 ItemLoader (net.runelite.cache.definitions.loaders.ItemLoader)2 ModelLoader (net.runelite.cache.definitions.loaders.ModelLoader)2 NpcLoader (net.runelite.cache.definitions.loaders.NpcLoader)2 ObjectLoader (net.runelite.cache.definitions.loaders.ObjectLoader)2 SpriteLoader (net.runelite.cache.definitions.loaders.SpriteLoader)2