Changeset 9919 for extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/ImageServiceImpl.java
- Timestamp:
- Mar 29, 2011, 8:21:25 PM (13 years ago)
- Location:
- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/impl/ImageServiceImpl.java
r9893 r9919 1 package fr.mael.jiwigo.service ;1 package fr.mael.jiwigo.service.impl; 2 2 3 3 import java.io.File; … … 6 6 import java.util.List; 7 7 8 import org.slf4j.Logger; 9 import org.slf4j.LoggerFactory; 10 8 11 import fr.mael.jiwigo.dao.ImageDao; 9 12 import fr.mael.jiwigo.om.Image; 13 import fr.mael.jiwigo.service.ImageService; 10 14 import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException; 11 15 import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; 12 16 import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException; 13 import fr.mael.jiwigo.transverse.session.SessionManager;14 17 import fr.mael.jiwigo.transverse.util.ImagesUtil; 15 18 import fr.mael.jiwigo.transverse.util.Tools; … … 32 35 * 33 36 */ 34 public class ImageService {37 public class ImageServiceImpl implements ImageService { 35 38 36 39 /** 37 40 * Logger 38 41 */ 39 public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory 40 .getLog(ImageService.class); 42 private final Logger LOG = LoggerFactory.getLogger(ImageServiceImpl.class); 41 43 42 /** 43 * Singleton 44 */ 45 private static ImageService instance; 46 47 private SessionManager sessionManager; 48 49 /** 50 * @return the singleton 51 */ 52 public static ImageService getInstance(SessionManager sessionManager) { 53 if (instance == null) { 54 instance = new ImageService(sessionManager); 55 } 56 return instance; 57 } 58 59 /** 60 * private constructor to use a singleton 61 */ 62 private ImageService(SessionManager sessionManager) { 63 this.sessionManager = sessionManager; 64 } 44 private ImageDao dao; 65 45 66 46 /** … … 73 53 public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws IOException, 74 54 ProxyAuthenticationException { 75 return ImageDao.getInstance(sessionManager).listByCategory(categoryId, rafraichir);55 return dao.listByCategory(categoryId, rafraichir); 76 56 } 77 57 … … 127 107 image.setPrivacyLevel(String.valueOf(privacyLevel)); 128 108 //now we call the dao to send the image to the webservice 129 return ImageDao.getInstance(sessionManager).create(image, chunckSize * 1000000);109 return dao.create(image, chunckSize * 1000000); 130 110 } 131 111 … … 139 119 */ 140 120 public boolean addTags(Image image, String tagId) throws IOException, ProxyAuthenticationException { 141 return ImageDao.getInstance(sessionManager).addTags(image.getIdentifier(), tagId);121 return dao.addTags(image.getIdentifier(), tagId); 142 122 } 143 123 … … 150 130 */ 151 131 public List<Image> search(String queryString) throws IOException, ProxyAuthenticationException { 152 return ImageDao.getInstance(sessionManager).search(queryString);132 return dao.search(queryString); 153 133 } 154 134 … … 165 145 } 166 146 147 public ImageDao getDao() { 148 return dao; 149 } 150 151 public void setDao(ImageDao dao) { 152 this.dao = dao; 153 } 154 167 155 }
Note: See TracChangeset
for help on using the changeset viewer.