001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2014-2016 ForgeRock AS.
015 */
016package org.opends.server.core;
017
018import org.forgerock.http.routing.Router;
019import org.forgerock.opendj.config.server.ServerManagementContext;
020import org.forgerock.opendj.server.config.server.RootCfg;
021import org.opends.server.extensions.DiskSpaceMonitor;
022import org.opends.server.loggers.CommonAudit;
023import org.opends.server.types.CryptoManager;
024import org.opends.server.types.DirectoryEnvironmentConfig;
025import org.opends.server.types.Schema;
026
027/** Context for the server, giving access to global properties of the server. */
028public interface ServerContext
029{
030  /**
031   * Returns the directory of server instance.
032   *
033   * @return the instance root directory
034   */
035  String getInstanceRoot();
036
037  /**
038   * Returns the root directory of server.
039   *
040   * @return the server root directory
041   */
042  String getServerRoot();
043
044  /**
045   * Returns the schema of the server.
046   *
047   * @return the schema
048   */
049  Schema getSchema();
050
051  /**
052   * Returns the new schema of the server (SDK schema).
053   * <p>
054   * This method will disappear once migration to new schema
055   * is finished. Meanwhile, it is necessary to keep both the
056   * legacy version and the new version.
057   *
058   * @return the new version of the schema
059   */
060  org.forgerock.opendj.ldap.schema.Schema getSchemaNG();
061
062  /**
063   * Returns the environment of the server.
064   *
065   * @return the environment
066   */
067  DirectoryEnvironmentConfig getEnvironment();
068
069  /**
070   * Returns the server management context, which gives
071   * an entry point on configuration objects.
072   *
073   * @return the server management context
074   */
075  ServerManagementContext getServerManagementContext();
076
077  /**
078   * Returns the root configuration object.
079   * <p>
080   * Equivalent to calling {@code getServerManagementContext().getRootConfiguration()}.
081   *
082   * @return the root configuration object
083   */
084  RootCfg getRootConfig();
085
086  /**
087   * Returns the memory quota system for reserving long term memory.
088   *
089   * @return the memory quota system
090   */
091  MemoryQuota getMemoryQuota();
092
093  /**
094   * Returns the Disk Space Monitoring service, for checking free disk space.
095   * Configure a directory to be monitored and optionally get alerted when
096   * disk space transitions from low to full to back to normal.
097   *
098   * @return the Disk Space Monitoring service
099   */
100  DiskSpaceMonitor getDiskSpaceMonitor();
101
102  /**
103   * Returns the HTTP request router.
104   *
105   * @return the HTTP Router service
106   */
107  Router getHTTPRouter();
108
109  /**
110   * Returns the common audit manager.
111   *
112   * @return the common audit manager
113   */
114  CommonAudit getCommonAudit();
115
116  /**
117   * Returns the logger config manager.
118   *
119   * @return the logger config manager
120   */
121  LoggerConfigManager getLoggerConfigManager();
122
123  /**
124   * Returns the Crypto Manager for the instance.
125   *
126   * @return the Crypto Manager for the instance
127   */
128  CryptoManager getCryptoManager();
129}