Created
March 18, 2022 05:46
-
-
Save donghyuck/8d022a89ea0e0886e938807a579244bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package architecture.studio.service; | |
import java.io.File; | |
import javax.inject.Inject; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import architecture.community.image.ImageService; | |
import architecture.ee.service.Repository; | |
public abstract class AbstractImageEffectsService implements ImageEffectsService { | |
@Inject | |
@Qualifier("repository") | |
private Repository repository; | |
private File imageDir; | |
protected Logger log = LoggerFactory.getLogger(getClass().getName()); | |
protected synchronized File getImageDir() { | |
if (imageDir == null) { | |
imageDir = repository.getFile(ImageService.IMAGE_DIR); | |
if (!imageDir.exists()) { | |
boolean result = imageDir.mkdir(); | |
if (!result) | |
log.error((new StringBuilder()).append("Unable to create image directory: '").append(imageDir).append("'").toString()); | |
getImageEffectDir(); | |
} | |
} | |
return imageDir; | |
} | |
public File getImageEffectDir() { | |
File dir = new File(getImageDir(), IMAGE_EFFECT_DIR); | |
if (!dir.exists()) { | |
dir.mkdir(); | |
} | |
return dir; | |
} | |
public File getImageAnnotationDir() { | |
File dir = new File(getImageDir(), ImageEffectsService.IMAGE_ANNOTATION_DIR); | |
if (!dir.exists()) { | |
dir.mkdir(); | |
} | |
return dir; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment