DriveMappingsConfigSection.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright (C) 2006-2010 Alfresco Software Limited.
  3. *
  4. * This file is part of Alfresco
  5. *
  6. * Alfresco is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Alfresco is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package org.alfresco.jlan.app;
  20. import org.alfresco.jlan.server.config.ConfigId;
  21. import org.alfresco.jlan.server.config.ConfigSection;
  22. import org.alfresco.jlan.server.config.InvalidConfigurationException;
  23. import org.alfresco.jlan.server.config.ServerConfiguration;
  24. import org.alfresco.jlan.smb.util.DriveMappingList;
  25. /**
  26. * Drive Mappings Configuration Section Class
  27. *
  28. * @author gkspencer
  29. */
  30. public class DriveMappingsConfigSection extends ConfigSection {
  31. // Drive mappings configuration section name
  32. public static final String SectionName = "DriveMappings";
  33. // Win32 local drive mappings to be added when the SMB/CIFS server has started
  34. private DriveMappingList m_mappedDrives;
  35. // Enable debug output
  36. private boolean m_debug;
  37. /**
  38. * Class constructor
  39. *
  40. * @param config ServerConfiguration
  41. */
  42. public DriveMappingsConfigSection(ServerConfiguration config) {
  43. super( SectionName, config);
  44. }
  45. /**
  46. * Check if debug output is enabled
  47. *
  48. * @return boolean
  49. */
  50. public final boolean hasDebug() {
  51. return m_debug;
  52. }
  53. /**
  54. * Determine if there are mapped drives specified to be added when the SMB/CIFS server has started
  55. *
  56. * @return boolean
  57. */
  58. public final boolean hasMappedDrives() {
  59. return m_mappedDrives != null ? true : false;
  60. }
  61. /**
  62. * Return the mapped drives list
  63. *
  64. * @return DriveMappingList
  65. */
  66. public final DriveMappingList getMappedDrives() {
  67. return m_mappedDrives;
  68. }
  69. /**
  70. * Add a list of mapped drives
  71. *
  72. * @param mappedDrives DriveMappingList
  73. * @return int
  74. * @exception InvalidConfigurationException
  75. */
  76. public final int setMappedDrives(DriveMappingList mappedDrives)
  77. throws InvalidConfigurationException {
  78. // Inform listeners, validate the configuration change
  79. int sts = fireConfigurationChange(ConfigId.SMBMappedDrives, mappedDrives);
  80. m_mappedDrives = mappedDrives;
  81. // Return the change status
  82. return sts;
  83. }
  84. /**
  85. * Enable/disable debug output
  86. *
  87. * @param dbg boolean
  88. */
  89. public final void setDebug(boolean dbg) {
  90. m_debug = dbg;
  91. }
  92. }