Changeset 9394 for extensions/jiwigo-ws-api/src/main/java/fr/mael
- Timestamp:
- Feb 27, 2011, 3:44:30 PM (14 years ago)
- Location:
- extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/ImageDao.java
r9392 r9394 9 9 import org.jdom.Document; 10 10 import org.jdom.Element; 11 import org.jdom.output.XMLOutputter;12 11 13 12 import sun.misc.BASE64Encoder; 14 13 import fr.mael.jiwigo.om.Image; 15 14 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum; 15 import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException; 16 16 import fr.mael.jiwigo.transverse.session.SessionManager; 17 17 import fr.mael.jiwigo.transverse.util.Tools; … … 74 74 private SessionManager sessionManager; 75 75 76 private ArrayList<File> filesToSend; 77 76 78 /** 77 79 * Private singleton, to use a singleton … … 157 159 //begin feature:0001827 158 160 int chunk = chunkSize.intValue(); 159 ArrayList<File> fichiersAEnvoyer = Tools.splitFile(image.getOriginale(), chunk); 161 if (chunk == 0) { 162 throw new WrongChunkSizeException("Error : the chunk size cannot be 0"); 163 } 164 filesToSend = Tools.splitFile(image.getOriginale(), chunk); 160 165 boolean echec = false; 161 for (int i = 0; i < fi chiersAEnvoyer.size(); i++) {162 File fichierAEnvoyer = fi chiersAEnvoyer.get(i);166 for (int i = 0; i < filesToSend.size(); i++) { 167 File fichierAEnvoyer = filesToSend.get(i); 163 168 String originaleBase64 = base64.encode(Tools.getBytesFromFile(fichierAEnvoyer)); 164 169 Document reponseOriginale = (sessionManager.executeReturnDocument("pwg.images.addChunk", "data", … … 228 233 myImage.setIdentifier(Integer.valueOf(im.getAttributeValue("id"))); 229 234 myImage.setName(im.getChildText("name")); 230 System.out.println(new XMLOutputter().outputString(im));231 235 // myImage.setIdCategory(Integer.valueOf(im.getChild("categories").getChild("category") 232 236 // .getAttributeValue("id"))); … … 258 262 file = new File(System.getProperty("java.io.tmpdir") + "/thumb.jpg"); 259 263 file.delete(); 264 for (File tempCut : filesToSend) { 265 tempCut.delete(); 266 } 260 267 261 268 } -
extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/ImageService.java
r9392 r9394 130 130 image.setPrivacyLevel(String.valueOf(privacyLevel)); 131 131 //now we call the dao to send the image to the webservice 132 return ImageDao.getInstance(sessionManager).create(image, chunckSize );132 return ImageDao.getInstance(sessionManager).create(image, chunckSize * 1000000); 133 133 } 134 134 -
extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java
r9392 r9394 167 167 method.addParameter("method", methode); 168 168 for (int i = 0; i < parametres.length; i += 2) { 169 System.out.println(parametres[i] + " -> " + parametres[i + 1]);169 // System.out.println(parametres[i] + " -> " + parametres[i + 1]); 170 170 method.addParameter(parametres[i], parametres[i + 1]); 171 171
Note: See TracChangeset
for help on using the changeset viewer.