001: /**
002: * LibreSource
003: * Copyright (C) 2004-2008 Artenum SARL / INRIA
004: * http://www.libresource.org - contact@artenum.com
005: *
006: * This file is part of the LibreSource software,
007: * which can be used and distributed under license conditions.
008: * The license conditions are provided in the LICENSE.TXT file
009: * at the root path of the packaging that enclose this file.
010: * More information can be found at
011: * - http://dev.libresource.org/home/license
012: *
013: * Initial authors :
014: *
015: * Guillaume Bort / INRIA
016: * Francois Charoy / Universite Nancy 2
017: * Julien Forest / Artenum
018: * Claude Godart / Universite Henry Poincare
019: * Florent Jouille / INRIA
020: * Sebastien Jourdain / INRIA / Artenum
021: * Yves Lerumeur / Artenum
022: * Pascal Molli / Universite Henry Poincare
023: * Gerald Oster / INRIA
024: * Mariarosa Penzi / Artenum
025: * Gerard Sookahet / Artenum
026: * Raphael Tani / INRIA
027: *
028: * Contributors :
029: *
030: * Stephane Bagnier / Artenum
031: * Amadou Dia / Artenum-IUP Blois
032: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
033: */package org.libresource.web.controllers.so6;
034:
035: import org.libresource.Libresource;
036:
037: import org.libresource.kernel.KernelConstants;
038: import org.libresource.kernel.LibresourceSecurityException;
039: import org.libresource.kernel.interfaces.KernelService;
040:
041: import org.libresource.membership.MembershipConstants;
042: import org.libresource.membership.interfaces.MembershipService;
043:
044: import org.libresource.so6.server.ls.LibresourceSynchronizerConstants;
045: import org.libresource.so6.server.ls.ejb.LibresourceSynchronizerServiceBean;
046: import org.libresource.so6.server.ls.interfaces.LibresourceSynchronizerService;
047:
048: import org.libresource.web.Controller;
049:
050: import java.net.URI;
051:
052: import javax.servlet.http.HttpServletRequest;
053: import javax.servlet.http.HttpServletResponse;
054:
055: public class CreateReplicaController implements Controller {
056: public Object process(URI uri, HttpServletRequest request,
057: HttpServletResponse response) throws Exception {
058: MembershipService membershipService = (MembershipService) Libresource
059: .getService(MembershipConstants.SERVICE);
060: String protocol = "http";
061:
062: KernelService kernelService = (KernelService) Libresource
063: .getService(KernelConstants.SERVICE);
064: LibresourceSynchronizerService libresourceSynchronizerService = (LibresourceSynchronizerService) Libresource
065: .getService(LibresourceSynchronizerConstants.SERVICE);
066:
067: if (!kernelService
068: .checkSecurity(
069: uri,
070: LibresourceSynchronizerServiceBean.SO6_CREATE_WORKSPACE)) {
071: throw new LibresourceSecurityException(
072: uri,
073: LibresourceSynchronizerServiceBean.SO6_CREATE_WORKSPACE);
074: }
075:
076: // props
077: if (request.isSecure()) {
078: protocol = "https";
079: }
080:
081: request.setAttribute("queueId", uri.toString());
082: request.setAttribute("login", membershipService.getProfile()
083: .getId());
084:
085: //
086: request.setAttribute("password", "");
087: request.setAttribute("wsName", "");
088: request.setAttribute("basePath", "");
089:
090: // Client specific props
091: request.setAttribute("soapEndpoint", protocol + "://"
092: + request.getServerName() + ":"
093: + request.getServerPort() + request.getContextPath()
094: + "/ls-so6/services/so6");
095:
096: //request.setAttribute("servletEndpoint", protocol + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/ls-so6/so6");
097: request.setAttribute("servletEndpoint", "/ls-so6/so6");
098:
099: request.setAttribute("encoding", libresourceSynchronizerService
100: .getSynchronizer(uri).getFileEncoding());
101:
102: return "/pages/modules/so6/jnlp/createReplica.jsp";
103: }
104: }
|