Search in sources :

Example 6 with CacheEntry

use of net.runelite.http.service.cache.beans.CacheEntry in project runelite by runelite.

the class CacheController method getCacheArchive.

@RequestMapping("{cacheId}/{indexId}/{archiveId}")
public CacheArchive getCacheArchive(@PathVariable int cacheId, @PathVariable int indexId, @PathVariable int archiveId) {
    CacheEntry cache = cacheService.findCache(cacheId);
    if (cache == null) {
        throw new NotFoundException();
    }
    IndexEntry indexEntry = cacheService.findIndexForCache(cache, indexId);
    if (indexEntry == null) {
        throw new NotFoundException();
    }
    ArchiveEntry archiveEntry = cacheService.findArchiveForIndex(indexEntry, archiveId);
    if (archiveEntry == null) {
        throw new NotFoundException();
    }
    return new CacheArchive(archiveEntry.getArchiveId(), archiveEntry.getNameHash(), archiveEntry.getRevision());
}
Also used : 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 7 with CacheEntry

use of net.runelite.http.service.cache.beans.CacheEntry in project runelite by runelite.

the class CacheController method getArchiveData.

@RequestMapping("{cacheId}/{indexId}/{archiveId}/data")
public byte[] getArchiveData(@PathVariable int cacheId, @PathVariable int indexId, @PathVariable int archiveId) {
    CacheEntry cache = cacheService.findCache(cacheId);
    if (cache == null) {
        throw new NotFoundException();
    }
    IndexEntry indexEntry = cacheService.findIndexForCache(cache, indexId);
    if (indexEntry == null) {
        throw new NotFoundException();
    }
    ArchiveEntry archiveEntry = cacheService.findArchiveForIndex(indexEntry, archiveId);
    if (archiveEntry == null) {
        throw new NotFoundException();
    }
    return cacheService.getArchive(archiveEntry);
}
Also used : 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 8 with CacheEntry

use of net.runelite.http.service.cache.beans.CacheEntry 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

CacheEntry (net.runelite.http.service.cache.beans.CacheEntry)8 ArchiveEntry (net.runelite.http.service.cache.beans.ArchiveEntry)7 IndexEntry (net.runelite.http.service.cache.beans.IndexEntry)7 NotFoundException (net.runelite.http.service.util.exception.NotFoundException)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 SpriteDefinition (net.runelite.cache.definitions.SpriteDefinition)4 SpriteLoader (net.runelite.cache.definitions.loaders.SpriteLoader)4 ArchiveFiles (net.runelite.cache.fs.ArchiveFiles)4 FSFile (net.runelite.cache.fs.FSFile)4 BufferedImage (java.awt.image.BufferedImage)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 IOException (java.io.IOException)3 TextureDefinition (net.runelite.cache.definitions.TextureDefinition)3 ModelLoader (net.runelite.cache.definitions.loaders.ModelLoader)3 TextureLoader (net.runelite.cache.definitions.loaders.TextureLoader)3 ItemProvider (net.runelite.cache.definitions.providers.ItemProvider)3 ModelProvider (net.runelite.cache.definitions.providers.ModelProvider)3 SpriteProvider (net.runelite.cache.definitions.providers.SpriteProvider)3 TextureProvider (net.runelite.cache.definitions.providers.TextureProvider)3 CacheArchive (net.runelite.http.api.cache.CacheArchive)3