You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServerSettings.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright 2011 gitblit.com.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.gitblit.models;
  17. import java.io.Serializable;
  18. import java.util.ArrayList;
  19. import java.util.List;
  20. import java.util.Map;
  21. import java.util.TreeMap;
  22. /**
  23. * Server settings represents the settings of the Gitblit server including all
  24. * setting metadata such as name, current value, default value, description, and
  25. * directives. It is a model class for serialization and presentation, but not
  26. * for persistence.
  27. *
  28. * @author James Moger
  29. */
  30. public class ServerSettings implements Serializable {
  31. private final Map<String, SettingModel> settings;
  32. private static final long serialVersionUID = 1L;
  33. public ServerSettings() {
  34. settings = new TreeMap<String, SettingModel>();
  35. }
  36. public List<String> getKeys() {
  37. return new ArrayList<String>(settings.keySet());
  38. }
  39. public void add(SettingModel setting) {
  40. settings.put(setting.name, setting);
  41. }
  42. public SettingModel get(String key) {
  43. return settings.get(key);
  44. }
  45. }