| | |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.admin.std.server.JEBackendCfg; |
| | | import org.opends.server.admin.std.server.LocalDBBackendCfg; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.config.ConfigException; |
| | |
| | | * of the entry containers. |
| | | */ |
| | | public class RootContainer |
| | | implements ConfigurationChangeListener<JEBackendCfg> |
| | | implements ConfigurationChangeListener<LocalDBBackendCfg> |
| | | { |
| | | /** |
| | | * The tracer object for the debug logger. |
| | |
| | | /** |
| | | * The backend configuration. |
| | | */ |
| | | private JEBackendCfg config; |
| | | private LocalDBBackendCfg config; |
| | | |
| | | /** |
| | | * The backend to which this entry root container belongs. |
| | |
| | | * @param backend A reference to the JE back end that is creating this |
| | | * root container. |
| | | */ |
| | | public RootContainer(Backend backend, JEBackendCfg config) |
| | | public RootContainer(Backend backend, LocalDBBackendCfg config) |
| | | { |
| | | this.env = null; |
| | | this.monitor = null; |
| | |
| | | this.config = config; |
| | | this.compressedSchema = null; |
| | | |
| | | config.addJEChangeListener(this); |
| | | config.addLocalDBChangeListener(this); |
| | | } |
| | | |
| | | /** |
| | |
| | | throws DatabaseException, ConfigException |
| | | { |
| | | // Determine the backend database directory. |
| | | File backendDirectory = getFileForPath(config.getBackendDirectory()); |
| | | File backendDirectory = getFileForPath(config.getDBDirectory()); |
| | | |
| | | //Make sure the directory is valid. |
| | | if (!backendDirectory.isDirectory()) |
| | |
| | | try |
| | | { |
| | | backendPermission = |
| | | FilePermission.decodeUNIXMode(config.getBackendMode()); |
| | | FilePermission.decodeUNIXMode(config.getDBDirectoryPermissions()); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | |
| | | } |
| | | |
| | | compressedSchema = new JECompressedSchema(env); |
| | | openAndRegisterEntryContainers(config.getBackendBaseDN()); |
| | | openAndRegisterEntryContainers(config.getBaseDN()); |
| | | } |
| | | |
| | | /** |
| | |
| | | env = null; |
| | | } |
| | | |
| | | config.removeJEChangeListener(this); |
| | | config.removeLocalDBChangeListener(this); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The JE backend configuration used by this root container. |
| | | */ |
| | | public JEBackendCfg getConfiguration() |
| | | public LocalDBBackendCfg getConfiguration() |
| | | { |
| | | return config; |
| | | } |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | JEBackendCfg cfg, |
| | | LocalDBBackendCfg cfg, |
| | | List<Message> unacceptableReasons) |
| | | { |
| | | boolean acceptable = true; |
| | | |
| | | File backendDirectory = getFileForPath(cfg.getBackendDirectory()); |
| | | File backendDirectory = getFileForPath(cfg.getDBDirectory()); |
| | | //Make sure the directory is valid. |
| | | if (!backendDirectory.isDirectory()) |
| | | { |
| | |
| | | try |
| | | { |
| | | FilePermission newBackendPermission = |
| | | FilePermission.decodeUNIXMode(cfg.getBackendMode()); |
| | | FilePermission.decodeUNIXMode(cfg.getDBDirectoryPermissions()); |
| | | |
| | | //Make sure the mode will allow the server itself access to |
| | | //the database |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange(JEBackendCfg cfg) |
| | | public ConfigChangeResult applyConfigurationChange(LocalDBBackendCfg cfg) |
| | | { |
| | | ConfigChangeResult ccr; |
| | | boolean adminActionRequired = false; |