All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.leopard.data.dfs.service.image.ThumbnailServiceImpl Maven / Gradle / Ivy

Go to download

分布式文件系统实现,目前只是做了基于GridFS的实现,可以在本机文件系统进行缓存。

There is a newer version: 0.9.12
Show newest version
package io.leopard.data.dfs.service.image;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import io.leopard.data.dfs.service.DfsService;

@Service
public class ThumbnailServiceImpl implements ThumbnailService {

	@Autowired
	private ThumbnailService thumbnailServiceSizeImpl;
	@Autowired
	private ThumbnailService thumbnailServiceCropImpl;

	@Autowired
	private DfsService dfsService;

	@Override
	public byte[] read(String filename) throws IOException {
		try {
			return dfsService.read(filename);
		}
		catch (FileNotFoundException e) {
			if (((ThumbnailServiceCropImpl) thumbnailServiceCropImpl).isCropFilename(filename)) {
				return thumbnailServiceCropImpl.read(filename);
			}
			else if (((ThumbnailServiceSizeImpl) thumbnailServiceSizeImpl).isSizeFilename(filename)) {
				return thumbnailServiceSizeImpl.read(filename);
			}
			else {
				throw e;
			}
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy