Configuration.java revision 77
340N/A/*
340N/A * CDDL HEADER START
340N/A *
340N/A * The contents of this file are subject to the terms of the
340N/A * Common Development and Distribution License (the "License").
340N/A * You may not use this file except in compliance with the License.
340N/A *
340N/A * See LICENSE.txt included in this distribution for the specific
340N/A * language governing permissions and limitations under the License.
340N/A *
340N/A * When distributing Covered Code, include this CDDL HEADER in each
340N/A * file and include the License file at LICENSE.txt.
340N/A * If applicable, add the following below this CDDL HEADER, with the
340N/A * fields enclosed by brackets "[]" replaced with your own identifying
340N/A * information: Portions Copyright [yyyy] [name of copyright owner]
340N/A *
340N/A * CDDL HEADER END
340N/A */
340N/A
340N/A/*
340N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
340N/A * Use is subject to license terms.
340N/A */
340N/Apackage org.opensolaris.opengrok.configuration;
340N/A
682N/Aimport java.util.ArrayList;
340N/Aimport java.util.HashMap;
340N/Aimport java.util.List;
340N/Aimport java.util.Map;
420N/Aimport org.opensolaris.opengrok.history.ExternalRepository;
682N/A
682N/A/**
682N/A * Placeholder class for all configuration variables. Due to the multithreaded
340N/A * nature of the web application, each thread will use the same instance of the
340N/A * configuration object for each page request. Class and methods should have
394N/A * package scope, but that didn't work with the XMLDecoder/XMLEncoder.
394N/A */
394N/Apublic class Configuration {
394N/A private String ctags;
459N/A private boolean historyCache;
394N/A private int historyCacheTime;
394N/A private List<Project> projects;
340N/A private String sourceRoot;
394N/A private String dataRoot;
394N/A private Map<String, ExternalRepository> repositories;
394N/A private String urlPrefix;
394N/A private boolean generateHtml;
394N/A private Project defaultProject;
340N/A
340N/A /** Creates a new instance of Configuration */
340N/A public Configuration() {
340N/A setHistoryCache(true);
340N/A setHistoryCacheTime(30);
340N/A setProjects(new ArrayList<Project>());
340N/A setRepositories(new HashMap<String, ExternalRepository>());
340N/A setUrlPrefix("/source/s?");
340N/A }
340N/A
340N/A public String getCtags() {
682N/A return ctags;
340N/A }
340N/A
340N/A public void setCtags(String ctags) {
682N/A this.ctags = ctags;
682N/A }
682N/A
682N/A public boolean isHistoryCache() {
682N/A return historyCache;
682N/A }
682N/A
682N/A public void setHistoryCache(boolean historyCache) {
682N/A this.historyCache = historyCache;
682N/A }
682N/A
682N/A public int getHistoryCacheTime() {
682N/A return historyCacheTime;
682N/A }
682N/A
682N/A public void setHistoryCacheTime(int historyCacheTime) {
682N/A this.historyCacheTime = historyCacheTime;
682N/A }
682N/A
682N/A public List<Project> getProjects() {
682N/A return projects;
682N/A }
682N/A
682N/A public void setProjects(List<Project> projects) {
682N/A this.projects = projects;
682N/A }
340N/A
434N/A public String getSourceRoot() {
340N/A return sourceRoot;
340N/A }
682N/A
682N/A public void setSourceRoot(String sourceRoot) {
682N/A this.sourceRoot = sourceRoot;
682N/A }
682N/A
682N/A public String getDataRoot() {
682N/A return dataRoot;
682N/A }
682N/A
682N/A public void setDataRoot(String dataRoot) {
682N/A this.dataRoot = dataRoot;
682N/A }
682N/A
682N/A public Map<String, ExternalRepository> getRepositories() {
682N/A return repositories;
682N/A }
682N/A
682N/A public void setRepositories(Map<String, ExternalRepository> repositories) {
682N/A this.repositories = repositories;
682N/A }
340N/A
682N/A public String getUrlPrefix() {
682N/A return urlPrefix;
340N/A }
340N/A
340N/A public void setUrlPrefix(String urlPrefix) {
340N/A this.urlPrefix = urlPrefix;
682N/A }
682N/A
682N/A public void setGenerateHtml(boolean generateHtml) {
682N/A this.generateHtml = generateHtml;
682N/A }
682N/A
682N/A public boolean isGenerateHtml() {
682N/A return generateHtml;
682N/A }
682N/A
682N/A public void setDefaultProject(Project defaultProject) {
682N/A this.defaultProject = defaultProject;
682N/A }
682N/A
682N/A public Project getDefaultProject() {
682N/A return defaultProject;
682N/A }
682N/A}
682N/A