001/*
002 * (C) Copyright 2008 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Thierry Delprat
018 */
019
020package org.nuxeo.ecm.webapp.context;
021
022import static org.jboss.seam.ScopeType.CONVERSATION;
023import static org.jboss.seam.ScopeType.EVENT;
024import static org.jboss.seam.annotations.Install.FRAMEWORK;
025
026import java.io.Serializable;
027
028import org.jboss.seam.annotations.Factory;
029import org.jboss.seam.annotations.Install;
030import org.jboss.seam.annotations.Name;
031import org.jboss.seam.annotations.Scope;
032import org.nuxeo.ecm.platform.util.RepositoryLocation;
033
034/**
035 * Externalize serverLocation Factory to avoid NavigationContext reentrant calls
036 *
037 * @author Thierry Delprat
038 */
039@Name("serverLocator")
040@Scope(CONVERSATION)
041@Install(precedence = FRAMEWORK)
042public class ServerContextBean implements Serializable {
043
044    private static final long serialVersionUID = 1L;
045
046    private RepositoryLocation currentServerLocation;
047
048    @Factory(value = "currentServerLocation", scope = EVENT)
049    public RepositoryLocation getCurrentServerLocation() {
050        return currentServerLocation;
051    }
052
053    public void setRepositoryLocation(RepositoryLocation serverLocation) {
054        this.currentServerLocation = serverLocation;
055    }
056}