01: /**
02: * LibreSource
03: * Copyright (C) 2004-2008 Artenum SARL / INRIA
04: * http://www.libresource.org - contact@artenum.com
05: *
06: * This file is part of the LibreSource software,
07: * which can be used and distributed under license conditions.
08: * The license conditions are provided in the LICENSE.TXT file
09: * at the root path of the packaging that enclose this file.
10: * More information can be found at
11: * - http://dev.libresource.org/home/license
12: *
13: * Initial authors :
14: *
15: * Guillaume Bort / INRIA
16: * Francois Charoy / Universite Nancy 2
17: * Julien Forest / Artenum
18: * Claude Godart / Universite Henry Poincare
19: * Florent Jouille / INRIA
20: * Sebastien Jourdain / INRIA / Artenum
21: * Yves Lerumeur / Artenum
22: * Pascal Molli / Universite Henry Poincare
23: * Gerald Oster / INRIA
24: * Mariarosa Penzi / Artenum
25: * Gerard Sookahet / Artenum
26: * Raphael Tani / INRIA
27: *
28: * Contributors :
29: *
30: * Stephane Bagnier / Artenum
31: * Amadou Dia / Artenum-IUP Blois
32: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33: */package org.libresource.web.controllers.so6;
34:
35: import org.libresource.Libresource;
36:
37: import org.libresource.kernel.KernelConstants;
38: import org.libresource.kernel.LibresourceSecurityException;
39: import org.libresource.kernel.interfaces.KernelService;
40:
41: import org.libresource.so6.server.ls.LibresourceSynchronizerConstants;
42: import org.libresource.so6.server.ls.PatchBean;
43: import org.libresource.so6.server.ls.ejb.LibresourceSynchronizerServiceBean;
44: import org.libresource.so6.server.ls.interfaces.LibresourceSynchronizerService;
45:
46: import org.libresource.web.Controller;
47:
48: import java.net.URI;
49:
50: import javax.servlet.http.HttpServletRequest;
51: import javax.servlet.http.HttpServletResponse;
52:
53: public class CompressController implements Controller {
54: public Object process(URI uri, HttpServletRequest request,
55: HttpServletResponse response) throws Exception {
56: KernelService kernelService = (KernelService) Libresource
57: .getService(KernelConstants.SERVICE);
58: LibresourceSynchronizerService libresourceSynchronizerService = (LibresourceSynchronizerService) Libresource
59: .getService(LibresourceSynchronizerConstants.SERVICE);
60:
61: if (!kernelService.checkSecurity(kernelService.getParent(uri),
62: LibresourceSynchronizerServiceBean.SO6_COMMIT)) {
63: throw new LibresourceSecurityException(kernelService
64: .getParent(uri),
65: LibresourceSynchronizerServiceBean.SO6_COMMIT);
66: }
67:
68: // ---------------------------------
69: // compress on client side
70: request.setAttribute("wsPath", libresourceSynchronizerService
71: .getWorkspaceConnection(uri).getWsPath());
72: request.setAttribute("encoding", libresourceSynchronizerService
73: .getSynchronizer(kernelService.getParent(uri))
74: .getFileEncoding());
75: request.setAttribute("from", request.getParameter("from"));
76: request.setAttribute("to", request.getParameter("to"));
77:
78: return "/pages/modules/so6/jnlp/compress.jsp";
79:
80: // ---------------------------------
81:
82: /*if ((request.getParameter("from") == null) || (request.getParameter("to") == null)) {
83: long lastTicket = libresourceSynchronizerService.getSynchronizer(uri).getLastTicket();
84: PatchBean[] patchList = libresourceSynchronizerService.listSynchronizerPatch(uri, 1);
85: patchList = libresourceSynchronizerService.listSynchronizerPatch(uri, 0);
86: for (int i = patchList.length; i > 0; i--) {
87: libresourceSynchronizerService.compressSynchronizer(uri, 1, patchList[i - 1].getToTicket());
88: }
89: } else {
90: long from = Long.parseLong(request.getParameter("from"));
91: long to = Long.parseLong(request.getParameter("to"));
92: libresourceSynchronizerService.compressSynchronizer(uri, from, to);
93: }
94: return uri + "?action=browse";*/
95: }
96: }
|