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