001/*
002 * (C) Copyright 2008 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Thierry Delprat
016 */
017
018package org.nuxeo.ecm.webapp.context;
019
020import static org.jboss.seam.ScopeType.CONVERSATION;
021import static org.jboss.seam.ScopeType.EVENT;
022import static org.jboss.seam.annotations.Install.FRAMEWORK;
023
024import java.io.Serializable;
025
026import org.jboss.seam.annotations.Factory;
027import org.jboss.seam.annotations.Install;
028import org.jboss.seam.annotations.Name;
029import org.jboss.seam.annotations.Scope;
030import org.nuxeo.ecm.platform.util.RepositoryLocation;
031
032/**
033 * Externalize serverLocation Factory to avoid NavigationContext reentrant calls
034 *
035 * @author Thierry Delprat
036 */
037@Name("serverLocator")
038@Scope(CONVERSATION)
039@Install(precedence = FRAMEWORK)
040public class ServerContextBean implements Serializable {
041
042    private static final long serialVersionUID = 1L;
043
044    private RepositoryLocation currentServerLocation;
045
046    @Factory(value = "currentServerLocation", scope = EVENT)
047    public RepositoryLocation getCurrentServerLocation() {
048        return currentServerLocation;
049    }
050
051    public void setRepositoryLocation(RepositoryLocation serverLocation) {
052        this.currentServerLocation = serverLocation;
053    }
054}