001/* 002 * (C) Copyright 2006-2009 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 * troger 016 */ 017package org.nuxeo.ecm.platform.annotations.gwt.client; 018 019import com.google.gwt.i18n.client.Dictionary; 020 021/** 022 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 023 */ 024public class ServerSettings { 025 026 private static final String SERVER_SETTINGS = "serverSettings"; 027 028 private static final String REPOSITORY_NAME = "repositoryName"; 029 030 private static final String DOCUMENT_ID = "documentId"; 031 032 private static final String CONTEXT_PATH = "contextPath"; 033 034 private static ServerSettings current = loadServerSettings(); 035 036 private String repositoryName; 037 038 private String documentId; 039 040 private String contextPath; 041 042 protected ServerSettings() { 043 } 044 045 public static ServerSettings getCurrent() { 046 return current; 047 } 048 049 protected static ServerSettings loadServerSettings() { 050 Dictionary dictionary = Dictionary.getDictionary(SERVER_SETTINGS); 051 String repositoryName = dictionary.get(REPOSITORY_NAME); 052 String documentId = dictionary.get(DOCUMENT_ID); 053 String contextPath = dictionary.get(CONTEXT_PATH); 054 055 ServerSettings serverSettings = new ServerSettings(); 056 serverSettings.repositoryName = repositoryName; 057 serverSettings.documentId = documentId; 058 serverSettings.contextPath = contextPath; 059 return serverSettings; 060 } 061 062 public String getRepositoryName() { 063 return repositoryName; 064 } 065 066 public String getDocumentId() { 067 return documentId; 068 } 069 070}