### LifecycleListener start() Method (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/git/SystemReaderInstaller Implements the start() method from the LifecycleListener interface. This method is invoked when the server is starting up, allowing for initialization of system readers. ```java /** * Invoked when the server is starting. */ @Override public void start() { // Implementation details for starting system readers } ``` -------------------------------- ### LifecycleListener start() Method Documentation Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/index/OnlineUpgrader Documentation for the start() method of the LifecycleListener interface, as implemented by OnlineUpgrader. This method is invoked when the server is starting. ```java public void start() // Description copied from interface: LifecycleListener // Invoked when the server is starting. // Specified by: // start in interface LifecycleListener ``` -------------------------------- ### GarbageCollectionLogFile start() Method - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/git/GarbageCollectionLogFile Starts the GarbageCollectionLogFile, typically invoked when the server is starting. This method implements the start() method from the LifecycleListener interface. ```Java public void start() Description copied from interface: LifecycleListener Invoked when the server is starting. Specified by: start in interface LifecycleListener ``` -------------------------------- ### Install Plugin API Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugins/InstallPlugin This API endpoint allows for the installation of a plugin into Gerrit. It accepts plugin details and returns information about the installed plugin. ```APIDOC ## POST /plugins ### Description Installs a new plugin into Gerrit. This endpoint is used to upload and enable new plugins. ### Method POST ### Endpoint /plugins ### Parameters #### Request Body - **name** (string) - Required - The name of the plugin to install. - **created** (boolean) - Optional - Indicates if the plugin was newly created. - **input** (InstallPluginInput) - Required - Input parameters for plugin installation. ### Request Example ```json { "name": "my-plugin", "created": true, "input": { "pluginData": "base64EncodedPlugin" } } ``` ### Response #### Success Response (200 OK) - **PluginInfo** (object) - Information about the installed plugin. - **name** (string) - The name of the plugin. - **version** (string) - The version of the plugin. - **enabled** (boolean) - Whether the plugin is currently enabled. #### Response Example ```json { "name": "my-plugin", "version": "1.0.0", "enabled": true } ``` #### Error Handling - **RestApiException** - Any subclass of `RestApiException` will result in a 4XX response. - **IOException** - Any other exception will result in a 500 Internal Server Error response. ``` -------------------------------- ### Setup Method - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/notedb/DeleteZombieCommentsRefs The setup method is responsible for initializing the necessary components for the DeleteZombieCommentsRefs class. It is specified in the DeleteZombieComments base class and may throw an IOException during its execution. ```java public void setup() throws IOException ``` -------------------------------- ### Install Plugin from Stream (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugins/PluginLoader The installPluginFromStream method allows installing a plugin from an InputStream. It takes the original plugin name and the input stream, and can throw IOException or PluginInstallException. ```java @CanIgnoreReturnValue public String installPluginFromStream(String originalName, InputStream in) throws IOException, PluginInstallException ``` -------------------------------- ### Setup Method Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/notedb/DeleteZombieCommentsRefs Initializes the DeleteZombieCommentsRefs instance. This method is part of the setup process for cleaning zombie comments, likely performing necessary preparations before execution. ```java void setup() ``` -------------------------------- ### Get Starting Index for Plugin List Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/extensions/api/plugins/Plugins Returns the starting index for pagination of the plugin list. ```java public int getStart() ``` -------------------------------- ### Utility Methods for Gerrit Site Initialization (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/pgm/init/api/InitUtil This snippet showcases various static utility methods provided by the InitUtil class for initializing a Gerrit site. These methods cover file operations like copying and directory creation, string parsing for domain names and hostnames, and URI manipulation. They are essential for setting up and configuring a Gerrit instance. ```Java public static void copy(Path dst, byte[] buf) throws IOException { // Implementation details for copying data } public static void mkdir(Path path) { // Implementation details for creating a directory } public static String hostname() { // Implementation details for retrieving the hostname return "localhost"; } public static URI toURI(String url) throws URISyntaxException { // Implementation details for converting a string to a URI return new URI(url); } public static void savePublic(org.eclipse.jgit.storage.file.FileBasedConfig sec) throws IOException { // Implementation details for saving public configuration } public static void extract(Path dst, Class sibling, String name) throws IOException { // Implementation details for extracting resources } public static String version() { // Implementation details for retrieving the version return "3.13.0-rc1"; } public static String dnOf(String name) { // Implementation details for getting the distinguished name return "cn=" + name; } public static String domainOf(String name) { // Implementation details for getting the domain name return "example.com"; } public static String username() { // Implementation details for retrieving the username return System.getProperty("user.name"); } public static boolean isLocal(String hostname) { // Implementation details for checking if a hostname is local return hostname.equals("localhost") || hostname.equals("127.0.0.1"); } public static boolean isAnyAddress(URI u) { // Implementation details for checking if a URI uses any address return u.getHost() == null; } public static int portOf(URI uri) { // Implementation details for retrieving the port from a URI return uri.getPort(); } public static void mkdir(File file) { // Implementation details for creating a directory from a File object } public static Die die(String why) { // Implementation details for throwing a Die exception return new Die(why); } public static Die die(String why, Throwable cause) { // Implementation details for throwing a Die exception with a cause return new Die(why, cause); } ``` -------------------------------- ### Get Start Line of Modifiable Content (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/patch/MagicFile Concrete method that returns the starting line number (1-based) of the modifiable content within the MagicFile. ```java public int getStartLineOfModifiableContent() ``` -------------------------------- ### Get Start of GitPositionTransformer.Range Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/patch/GitPositionTransformer This abstract method retrieves the starting point (inclusive) of the GitPositionTransformer.Range. It is a fundamental operation for determining the beginning of a line range within the Gerrit plugin API. ```java public abstract int start() ``` -------------------------------- ### GET /plugins Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugins/ListPlugins Retrieves a list of installed plugins. This endpoint allows filtering and pagination of the plugin list. ```APIDOC ## GET /plugins ### Description Lists the installed plugins. This endpoint supports filtering by prefix, substring, and regular expression, as well as pagination with limit and start parameters. ### Method GET ### Endpoint /plugins ### Parameters #### Query Parameters - **all** (boolean) - Optional - If true, return all plugins, not just those enabled. - **limit** (int) - Optional - The maximum number of plugins to return. - **start** (int) - Optional - The offset for pagination. - **matchPrefix** (string) - Optional - Filter plugins whose names start with this prefix. - **matchSubstring** (string) - Optional - Filter plugins whose names contain this substring. - **matchRegex** (string) - Optional - Filter plugins whose names match this regular expression. ### Request Example ```json { "example": "GET /plugins?limit=10&start=0&matchPrefix=myplugin" } ``` ### Response #### Success Response (200) - **plugins** (object) - A map where keys are plugin names and values are PluginInfo objects. - **id** (string) - The plugin ID. - **name** (string) - The plugin name. - **version** (string) - The plugin version. - **description** (string) - A description of the plugin. - **enabled** (boolean) - Whether the plugin is enabled. #### Response Example ```json { "example": { "myplugin-1.0": { "id": "myplugin", "name": "My Plugin", "version": "1.0", "description": "A sample plugin", "enabled": true } } } ``` ``` -------------------------------- ### Java Method: onStartPlugin Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugins/StartPluginListener The onStartPlugin method is part of the StartPluginListener interface. It is invoked by the system when a plugin has been loaded and is ready for use. Implementations of this method can perform actions such as registering services or initializing components based on the provided Plugin object. ```java /** * Broadcasts event indicating a plugin was loaded. * @param plugin The loaded plugin. */ void onStartPlugin(Plugin plugin); ``` -------------------------------- ### Get References by Prefix - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/git/DelegateRefDatabase Retrieves all references that start with a given prefix. This method is specified in the RefDatabase interface and may throw an IOException. ```java public Map getRefs(String prefix) throws IOException ``` -------------------------------- ### VersionedMetaDataOnInit Constructor and Methods - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/pgm/init/api/VersionedMetaDataOnInit This snippet shows the constructor and key methods of the VersionedMetaDataOnInit class. It includes the constructor signature, methods for loading and saving metadata, and opening a Git repository. Note the exception handling for IO and configuration errors. ```Java protected VersionedMetaDataOnInit(InitFlags flags, SitePaths site, String project, String ref) protected String getRefName() public VersionedMetaDataOnInit load() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException public void save(String message) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException protected void save(org.eclipse.jgit.lib.PersonIdent ident, String msg) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException public org.eclipse.jgit.lib.Repository openGitRepository() throws IOException ``` -------------------------------- ### AccountLoader Usage Example in Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/account/AccountLoader Demonstrates the typical workflow for using the AccountLoader class. It involves getting an AccountInfo, potentially adding it with 'put', and then calling 'fill' to populate its properties. The 'get' method can be called again to retrieve the filled AccountInfo. ```java AccountLoader loader = ...; // Obtain an AccountLoader instance Account.Id accountId = ...; // Specify the account ID // 1. Get AccountInfo for a given id (initially unfilled) AccountInfo info = loader.get(accountId); // 2. Optionally, provide an AccountInfo to be filled // AccountInfo existingInfo = ...; // loader.put(existingInfo); // 3. Fill the properties of the AccountInfo(s) try { loader.fill(); } catch (PermissionBackendException e) { // Handle exception } // 4. Get the filled AccountInfo again if needed AccountInfo filledInfo = loader.get(accountId); // Example of filling a collection // Collection infosToFill = ...; try { loader.fill(infosToFill); } catch (PermissionBackendException e) { // Handle exception } // Example of filling a single account and getting it // AccountInfo filledSingleInfo = loader.fillOne(accountId); ``` -------------------------------- ### GET /projects/?query=QUERY Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/restapi/project/QueryProjects This endpoint allows querying projects based on a provided query string. It supports filtering by limit and start offsets for pagination. ```APIDOC ## GET /projects/?query=QUERY ### Description Queries projects using a specified query string. Supports pagination parameters like limit and start. ### Method GET ### Endpoint /projects/ ### Parameters #### Query Parameters - **query** (String) - Required - The query string to filter projects. - **limit** (int) - Optional - The maximum number of projects to return. - **start** (int) - Optional - The starting offset for the project list. ### Request Example ```json { "query": "my-project*", "limit": 10, "start": 0 } ``` ### Response #### Success Response (200) - **List** - A list of project information objects matching the query. #### Response Example ```json [ { "id": "my-project-1", "name": "My Project 1", "description": "This is the first project." }, { "id": "my-project-2", "name": "My Project 2", "description": "This is the second project." } ] ``` ``` -------------------------------- ### StartupChecks Lifecycle Methods Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/StartupChecks Provides details on the start and stop methods of the StartupChecks class, which are part of the server lifecycle. ```APIDOC ## GET /api/startupchecks/start ### Description Invoked when the server is starting. This method is part of the LifecycleListener interface. ### Method GET ### Endpoint /api/startupchecks/start ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example (No request body for this GET endpoint) ### Response #### Success Response (200) - **status** (string) - Indicates the success of the startup operation. #### Response Example ```json { "status": "success" } ``` ## GET /api/startupchecks/stop ### Description Invoked when the server is stopping. This method is part of the LifecycleListener interface. ### Method GET ### Endpoint /api/startupchecks/stop ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example (No request body for this GET endpoint) ### Response #### Success Response (200) - **status** (string) - Indicates the success of the shutdown operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### GET /accounts//avatar Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/restapi/account/GetAvatar This REST endpoint retrieves the avatar image of a specified account. Avatar images are only available if an AvatarProvider plugin is installed. ```APIDOC ## GET /accounts//avatar ### Description REST endpoint to get the avatar image of an account. Avatar images are only available if an `AvatarProvider` plugin is installed. ### Method GET ### Endpoint `/accounts//avatar` ### Parameters #### Path Parameters - **account-identifier** (string) - Required - The identifier of the account whose avatar is to be retrieved. #### Query Parameters - **s** (integer) - Optional - The desired size of the avatar image. ### Response #### Success Response (200) - **Response.Redirect** - A redirect response to the avatar image URL. #### Response Example ```json { "example": "302 Found" } ``` #### Error Response - **404 Not Found** - If the account or avatar is not found. - **500 Internal Server Error** - For any other unexpected errors. ``` -------------------------------- ### InitStep Interface Documentation Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/pgm/init/api/InitStep Documentation for the InitStep interface, which represents a single step in the site initialization process. ```APIDOC ## InitStep Interface ### Description A single step in the site initialization process. ### Methods #### run ```java void run() throws Exception ``` **Description:** Executes the initialization step. **Throws:** * `Exception` - If an error occurs during execution. #### postRun ```java default void postRun() throws Exception ``` **Description:** Executed after the site has been initialized. **Throws:** * `Exception` - If an error occurs during execution. ``` -------------------------------- ### AbstractGitCommand Methods Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/sshd/AbstractGitCommand Key methods of the AbstractGitCommand class, including 'start' for initializing the command, 'runImpl' for executing the command logic, and 'accept' for handling trace IDs. ```java public void start(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env) { // Implementation omitted for brevity } protected abstract void runImpl() throws IOException, PermissionBackendException, BaseCommand.Failure; public void accept(String tagName, String traceId) { // Implementation omitted for brevity } ``` -------------------------------- ### Java: Get Instance and Project Name Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/mail/send/BranchEmailUtils Constructs a project name by prepending the instance name. This is useful for uniquely identifying projects within a distributed Gerrit setup. ```java public static String getInstanceAndProjectName(String instanceName, String projectName) ``` -------------------------------- ### GET /accounts//avatar.change.url Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/restapi/account/GetAvatarChangeUrl Retrieves the URL for changing an account's avatar image. This endpoint requires an AvatarProvider plugin to be installed, and not all providers offer this functionality. ```APIDOC ## GET /accounts//avatar.change.url ### Description This endpoint retrieves the URL that can be used to change the avatar image for a specific account. Avatar images are only available if an `AvatarProvider` plugin is installed, and the availability of a change URL depends on the specific provider. ### Method GET ### Endpoint `/accounts//avatar.change.url` ### Parameters #### Path Parameters - **account-identifier** (string) - Required - The identifier for the account whose avatar change URL is being requested. ### Request Example ```json { "example": "No request body needed for GET request." } ``` ### Response #### Success Response (200) - **response** (Response) - A `Response` object containing the URL for changing the avatar. The actual URL is the string value within this response. #### Response Example ```json { "example": "{\"url\": \"http://example.com/change-avatar/12345\"}" } ``` #### Error Handling - `ResourceNotFoundException`: Thrown if the account or avatar information is not found, resulting in a 404 Not Found response. - Other `RestApiException` subclasses: Result in 4xx client errors. - Any other exception: Results in a 500 Internal Server Error response. ``` -------------------------------- ### AliasCommand Start Method Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/sshd/AliasCommand The start method initiates the execution of the command. It takes the SSH channel session and environment as parameters and can throw an IOException. This method is part of the command's lifecycle management. ```java public void start(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env) throws IOException ``` -------------------------------- ### InitFlags Constructor - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/pgm/init/api/InitFlags This snippet shows the constructor for the InitFlags class. It indicates that the constructor is annotated with @Inject, suggesting dependency injection is used. It takes SitePaths, SecureStore, a List of Strings for installPlugins, and a Boolean for installAllPlugins as arguments. It can also throw IOException and ConfigInvalidException. ```java @Inject public InitFlags(SitePaths site, SecureStore secureStore, List installPlugins, Boolean installAllPlugins) throws IOException, org.eclipse.jgit.errors.ConfigInvalidException ``` -------------------------------- ### Get End of GitPositionTransformer.Range Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/patch/GitPositionTransformer This abstract method retrieves the ending point (exclusive) of the GitPositionTransformer.Range. It is crucial for defining the extent of a line range and is commonly used in conjunction with the start() method. ```java public abstract int end() ``` -------------------------------- ### Get Plugin Name - WebUiPlugin Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/extensions/webui/WebUiPlugin The getPluginName method returns the installed name of the plugin that provides the associated UI feature. This is a concrete method available to all subclasses. ```java public final String getPluginName() ``` -------------------------------- ### Get Guice Module for ChangeNotesCache (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/notedb/ChangeNotesCache Retrieves the Guice Module associated with the ChangeNotesCache. This is typically used for dependency injection setup within a Gerrit plugin. No specific inputs are required, and the output is a Guice Module object. ```java com.google.inject.Module com.google.gerrit.server.notedb.ChangeNotesCache.module() ``` -------------------------------- ### ProjectConfigEntry Constructors Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/config/ProjectConfigEntry This section lists all available constructors for the ProjectConfigEntry class, detailing the parameters each constructor accepts for initializing a project configuration entry. ```APIDOC ## ProjectConfigEntry Constructors ### ProjectConfigEntry(String displayName, String defaultValue) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (String) - The default value for the configuration entry. ### ProjectConfigEntry(String displayName, String defaultValue, boolean inheritable) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (String) - The default value for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. ### ProjectConfigEntry(String displayName, String defaultValue, boolean inheritable, String description) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (String) - The default value for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. - **description** (String) - A description of the configuration entry. ### ProjectConfigEntry(String displayName, int defaultValue) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (int) - The default value for the configuration entry. ### ProjectConfigEntry(String displayName, int defaultValue, boolean inheritable) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (int) - The default value for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. ### ProjectConfigEntry(String displayName, int defaultValue, boolean inheritable, String description) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (int) - The default value for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. - **description** (String) - A description of the configuration entry. ### ProjectConfigEntry(String displayName, long defaultValue) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (long) - The default value for the configuration entry. ### ProjectConfigEntry(String displayName, long defaultValue, boolean inheritable) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (long) - The default value for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. ### ProjectConfigEntry(String displayName, long defaultValue, boolean inheritable, String description) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (long) - The default value for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. - **description** (String) - A description of the configuration entry. ### ProjectConfigEntry(String displayName, boolean defaultValue) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (boolean) - The default value for the configuration entry. ### ProjectConfigEntry(String displayName, boolean defaultValue, String description) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (boolean) - The default value for the configuration entry. - **description** (String) - A description of the configuration entry. ### ProjectConfigEntry(String displayName, String defaultValue, List permittedValues) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (String) - The default value for the configuration entry. - **permittedValues** (List) - A list of permitted values for the configuration entry. ### ProjectConfigEntry(String displayName, String defaultValue, List permittedValues, boolean inheritable) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (String) - The default value for the configuration entry. - **permittedValues** (List) - A list of permitted values for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. ### ProjectConfigEntry(String displayName, String defaultValue, List permittedValues, boolean inheritable, String description) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (String) - The default value for the configuration entry. - **permittedValues** (List) - A list of permitted values for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. - **description** (String) - A description of the configuration entry. ### ProjectConfigEntry(String displayName, T defaultValue, Class permittedValues) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (T) - The default value for the configuration entry. - **permittedValues** (Class) - The class representing the permitted values. ### ProjectConfigEntry(String displayName, T defaultValue, Class permittedValues, boolean inheritable) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (T) - The default value for the configuration entry. - **permittedValues** (Class) - The class representing the permitted values. - **inheritable** (boolean) - Indicates if the configuration is inheritable. ### ProjectConfigEntry(String displayName, T defaultValue, Class permittedValues, boolean inheritable, String description) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (T) - The default value for the configuration entry. - **permittedValues** (Class) - The class representing the permitted values. - **inheritable** (boolean) - Indicates if the configuration is inheritable. - **description** (String) - A description of the configuration entry. ### ProjectConfigEntry(String displayName, String defaultValue, ProjectConfigEntryType type, List permittedValues, boolean inheritable, String description) - **displayName** (String) - The display name for the configuration entry. - **defaultValue** (String) - The default value for the configuration entry. - **type** (ProjectConfigEntryType) - The type of the configuration entry. - **permittedValues** (List) - A list of permitted values for the configuration entry. - **inheritable** (boolean) - Indicates if the configuration is inheritable. - **description** (String) - A description of the configuration entry. ``` -------------------------------- ### Java GetAvatar Class Documentation Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/restapi/account/GetAvatar This snippet provides the Javadoc for the GetAvatar class, which is a REST endpoint for fetching user avatars. It implements the RestReadView interface and handles GET requests to retrieve avatar images. Avatar availability depends on an installed AvatarProvider plugin. ```java package com.google.gerrit.server.restapi.account; import com.google.gerrit.extensions.restapi.ResourceNotFoundException; import com.google.gerrit.extensions.restapi.Response; import com.google.gerrit.extensions.restapi.RestReadView; import com.google.gerrit.extensions.restapi.RestView; public class GetAvatar extends Object implements RestReadView { public void setSize(int s) { // Method implementation } public Response.Redirect apply(AccountResource rsrc) throws ResourceNotFoundException { // Method implementation return null; // Placeholder } } ``` -------------------------------- ### SystemGroupBackend Class Overview Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/group/SystemGroupBackend Provides an overview of the SystemGroupBackend class, its fields, constructors, and methods. ```APIDOC ## SystemGroupBackend `public class SystemGroupBackend extends AbstractGroupBackend` Handles system-defined groups like Anonymous Users, Registered Users, Project Owners, and Change Owner. ### Fields * `ANONYMOUS_USERS` (AccountGroup.UUID) - UUID for the "Anonymous Users" group. * `CHANGE_OWNER` (AccountGroup.UUID) - UUID for the "Change Owner" placeholder group. * `PROJECT_OWNERS` (AccountGroup.UUID) - UUID for the "Project Owners" placeholder group. * `REGISTERED_USERS` (AccountGroup.UUID) - UUID for the "Registered Users" group. * `SYSTEM_GROUP_SCHEME` (String) - Identifier for the system group scheme. ### Constructor * `SystemGroupBackend(org.eclipse.jgit.lib.Config cfg)` - Constructs a new SystemGroupBackend with the given configuration. ### Methods * `get(AccountGroup.UUID uuid)` (GroupDescription.Basic) - Looks up a group by its UUID. * `getGroup(AccountGroup.UUID uuid)` (GroupReference) - Retrieves a group reference by UUID. * `getNames()` (Set) - Returns all known group names. * `getReservedNames()` (Set) - Returns reserved group names. * `handles(AccountGroup.UUID uuid)` (boolean) - Checks if the backend handles the given UUID. * `isAnonymousOrRegistered(AccountGroup.UUID uuid)` (static boolean) - Checks if a UUID belongs to Anonymous or Registered Users. * `isAnonymousOrRegistered(GroupReference ref)` (static boolean) - Checks if a group reference belongs to Anonymous or Registered Users. * `isSystemGroup(AccountGroup.UUID uuid)` (static boolean) - Checks if a UUID belongs to a system group. * `membershipsOf(CurrentUser user)` (GroupMembership) - Returns the group membership checker for a user. * `suggest(String name, ProjectState project)` (Collection) - Provides group name suggestions. ``` -------------------------------- ### ProjectNameKeyAdapter Constructor - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/events/ProjectNameKeyAdapter Initializes a new instance of the ProjectNameKeyAdapter class. This constructor does not take any arguments and sets up the adapter for use with Gson's serialization and deserialization processes for Project.NameKey objects. ```java public ProjectNameKeyAdapter() ``` -------------------------------- ### UrlFormatter Interface - Get Web URL Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/config/UrlFormatter This method returns the canonical base URL for the Gerrit installation. It's essential for constructing other relative URLs. The method returns an Optional, and for default implementations to work correctly, this URL should end with a '/'. ```Java Optional getWebUrl() ``` -------------------------------- ### DelegateRefDatabase Constructor Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/git/DelegateRefDatabase Initializes a new DelegateRefDatabase with a given repository delegate. ```APIDOC ## DelegateRefDatabase Constructor ### Description Initializes a new `DelegateRefDatabase` with a provided `Repository` delegate. ### Method `public DelegateRefDatabase(org.eclipse.jgit.lib.Repository delegate)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Plugin Lifecycle Methods Example Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugins/ServerPlugin This snippet includes methods that manage the lifecycle of a plugin. `start` initializes the plugin's environment, `stop` performs cleanup, and `canReload` determines if the plugin supports hot-reloading. These methods are typically overridden by specific plugin implementations. ```java protected void start(PluginGuiceEnvironment env) throws Exception ``` ```java protected void stop(PluginGuiceEnvironment env) ``` ```java protected boolean canReload() ``` -------------------------------- ### RepoView Constructor Example Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/update/RepoView This constructor initializes a RepoView, providing a restricted view of a Git repository. It takes the repository object, a RevWalk instance, and an ObjectInserter as arguments. ```java RepoView( org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter inserter ) ``` -------------------------------- ### Plugin Class Constructor and Methods Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugins/Plugin This snippet shows the constructor and various methods of the Plugin class. It includes methods for getting plugin information like name, version, and API details, as well as methods for managing plugin lifecycle (start, stop) and adding registration handles. Some methods are abstract and require implementation in subclasses. ```java public Plugin(String name, Path srcPath, PluginUser pluginUser, org.eclipse.jgit.internal.storage.file.FileSnapshot snapshot, Plugin.ApiType apiType) public void add(RegistrationHandle handle) protected abstract boolean canReload() abstract com.google.inject.Injector getApiInjector() Optional getApiModule() Plugin.ApiType getApiType() String getApiVersion() Plugin.CacheKey getCacheKey() com.google.gerrit.server.plugins.CleanupHandle getCleanupHandle() abstract PluginContentScanner getContentScanner() abstract com.google.inject.Injector getHttpInjector() String getName() Path getSrcFile() abstract com.google.inject.Injector getSshInjector() abstract com.google.inject.Injector getSysInjector() abstract String getVersion() boolean isDisabled() void setCleanupHandle(com.google.gerrit.server.plugins.CleanupHandle cleanupHandle) protected abstract void start(PluginGuiceEnvironment env) throws Exception protected abstract void stop(PluginGuiceEnvironment env) String toString() ``` -------------------------------- ### FetchInfo Constructor with URL and Ref - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/extensions/common/FetchInfo Provides a constructor for the FetchInfo class that initializes the URL and ref fields. This is a common way to create a FetchInfo object with essential details. ```java public FetchInfo(String url, String ref) ``` -------------------------------- ### PeriodicIndexScheduler start() Method (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/index/scheduler/PeriodicIndexScheduler The start() method is invoked when the server is starting. This method is specified by the LifecycleListener interface. ```java public void start() Description copied from interface: LifecycleListener Invoked when the server is starting. Specified by: start in interface LifecycleListener ``` -------------------------------- ### Project Creation API Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/overview-tree Endpoints for creating new projects within Gerrit. ```APIDOC ## POST /projects ### Description Creates a new project in Gerrit. ### Method POST ### Endpoint /projects ### Parameters #### Request Body - **name** (string) - Required - The name of the new project. - **parent** (string) - Optional - The name of the parent project. - **branches** (array) - Optional - A list of initial branches to create. - **name** (string) - Required - The name of the branch. - **revision** (string) - Optional - The commit SHA to base the branch on. ### Request Example ```json { "name": "my-new-project", "parent": "base-project", "branches": [ { "name": "main", "revision": "abcdef1234567890" } ] } ``` ### Response #### Success Response (201) - **name** (string) - The name of the created project. - **url** (string) - The URL of the created project. #### Response Example ```json { "name": "my-new-project", "url": "/projects/my-new-project" } ``` ``` ```APIDOC ## POST /projects/{projectName}/branches ### Description Creates a new branch for a given project. ### Method POST ### Endpoint /projects/{projectName}/branches ### Parameters #### Path Parameters - **projectName** (string) - Required - The name of the project. #### Request Body - **name** (string) - Required - The name of the new branch. - **revision** (string) - Optional - The commit SHA to base the branch on. ### Request Example ```json { "name": "feature-branch", "revision": "abcdef1234567890" } ``` ### Response #### Success Response (201) - **ref** (string) - The reference of the created branch (e.g., refs/heads/feature-branch). #### Response Example ```json { "ref": "refs/heads/feature-branch" } ``` ``` -------------------------------- ### Project Creation API Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/extensions/api/projects/ProjectApi Endpoints for creating new projects. ```APIDOC ## POST /api/projects ### Description Creates a new project. ### Method POST ### Endpoint /api/projects ### Parameters #### Request Body - **in** (ProjectInput) - Optional - Input for project creation. ### Request Example ```json { "name": "new-project", "parent": "parent-project" } ``` ### Response #### Success Response (200) - **ProjectInfo** (object) - Information about the created project. #### Response Example ```json { "name": "new-project", "id": "new-project", "parent": "parent-project" } ``` ``` -------------------------------- ### Install AccountCacheImpl using Guice Modules (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/account/AccountCacheImpl Demonstrates how to install the AccountCacheImpl class as a singleton within a Guice dependency injection framework. This involves calling static module methods provided by the AccountCacheImpl class. ```java install(AccountCacheImpl.module()); install(AccountCacheImpl.bindingModule()); ``` -------------------------------- ### Abstract Method for Post-Load Setup (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/git/meta/VersionedMetaData Abstract method to be implemented by subclasses for setting up metadata after loading. This method is responsible for parsing any state from the loaded revision. It can throw IOExceptions or ConfigInvalidExceptions. ```java protected abstract void onLoad() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException ``` -------------------------------- ### AliasCommandProvider Constructor and Get Method Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/sshd/AliasCommandProvider This Java code defines the constructor and the get() method for the AliasCommandProvider class. The constructor takes a CommandName as an argument, and the get() method returns an instance of org.apache.sshd.server.command.Command. ```java public class AliasCommandProvider extends Object implements com.google.inject.Provider { public AliasCommandProvider(CommandName command) { } public org.apache.sshd.server.command.Command get() { } } ``` -------------------------------- ### SecureStoreProvider Constructor Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/securestore/SecureStoreProvider Constructs a new SecureStoreProvider. It requires an Injector, SitePaths, and a class name for secure store initialization. This is typically used internally by the Gerrit system. ```java @Inject protected SecureStoreProvider(com.google.inject.Injector injector, SitePaths sitePaths, String className) ``` -------------------------------- ### GET /accounts/{id}/state Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/restapi/account/GetState Retrieves the superset of all information related to an account. This information is useful to inspect issues with the account and its permissions. Users can only get their own account state. Getting the account state of other users is not allowed. ```APIDOC ## GET /accounts/{id}/state ### Description Retrieves the superset of all information related to an account. This information is useful to inspect issues with the account and its permissions. Users can only get their own account state. Getting the account state of other users is not allowed. ### Method GET ### Endpoint /accounts/{id}/state ### Parameters #### Path Parameters - **id** (string) - Required - The account ID to retrieve the state for. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **username** (string) - The username of the account. - **name** (string) - The display name of the account. - **email** (string) - The email address of the account. - **status** (string) - The status of the account (e.g., "active", "registered"). - **secondaryEmails** (array) - A list of secondary email addresses associated with the account. - **isConfirmed** (boolean) - Indicates if the account is confirmed. - **registeredOn** (string) - The timestamp when the account was registered (ISO 8601 format). - **pluginInfo** (object) - An object containing plugin-specific information. #### Response Example ```json { "username": "john.doe", "name": "John Doe", "email": "john.doe@example.com", "status": "active", "secondaryEmails": [], "isConfirmed": true, "registeredOn": "2023-01-01T10:00:00Z", "pluginInfo": {} } ``` ``` -------------------------------- ### PluginSetContext Constructor Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugincontext/PluginSetContext Initializes a new instance of the PluginSetContext class. It requires a DynamicSet of extensions and plugin metrics for tracking. ```java public PluginSetContext(DynamicSet dynamicSet, PluginContext.PluginMetrics pluginMetrics) ``` -------------------------------- ### DashboardApi Interface - Get Methods (Java) Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/extensions/api/projects/DashboardApi Provides methods to retrieve dashboard information. The get() method retrieves the default dashboard, while get(boolean inherited) allows specifying whether to include inherited dashboard settings. Both methods can throw a RestApiException. ```java /** * Retrieves dashboard information. * @return DashboardInfo object. * @throws RestApiException if a REST API error occurs. */ DashboardInfo get() throws RestApiException; /** * Retrieves dashboard information, optionally including inherited settings. * @param inherited true to include inherited settings, false otherwise. * @return DashboardInfo object. * @throws RestApiException if a REST API error occurs. */ DashboardInfo get(boolean inherited) throws RestApiException; ``` -------------------------------- ### Group API - Get Group Info Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/extensions/api/groups/GroupApi Retrieves information about a group. Use `detail()` for full options or `get()` for basic info. ```APIDOC ## GET /groups/{groupId} ### Description Retrieves information about a specific group. ### Method GET ### Endpoint `/groups/{groupId}` ### Parameters #### Path Parameters - **groupId** (String) - Required - The unique identifier of the group. ### Response #### Success Response (200) - **GroupInfo** (Object) - Contains detailed information about the group. #### Response Example ```json { "name": "Administrators", "id": "1", "groupId": " Administrators ", "description": "Users with administrative privileges", "owner": "admin", "options": {}, "members_count": 5, "url": "/groups/Administrators" } ``` ``` ```APIDOC ## GET /groups/{groupId}/detail ### Description Retrieves detailed information about a specific group, including all `ListGroupsOption`s. ### Method GET ### Endpoint `/groups/{groupId}/detail` ### Parameters #### Path Parameters - **groupId** (String) - Required - The unique identifier of the group. ### Response #### Success Response (200) - **GroupInfo** (Object) - Contains detailed information about the group with all options set. #### Response Example ```json { "name": "Administrators", "id": "1", "groupId": " Administrators ", "description": "Users with administrative privileges", "owner": "admin", "options": { "visible_to_external_members": false }, "members_count": 5, "url": "/groups/Administrators" } ``` ``` -------------------------------- ### RepoView Constructor Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/update/RepoView Initializes a new RepoView instance with a repository, revision walk, and object inserter. ```APIDOC ## RepoView Constructor ### Description Initializes a new RepoView instance. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java RepoView repoView = new RepoView(repo, rw, inserter); ``` ### Response N/A ``` -------------------------------- ### Set Start Index for Projects - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/restapi/project/AbstractListProjects Sets the starting index for retrieving projects. This is used in conjunction with 'limit' for pagination. ```java public abstract void setStart(int start) ``` -------------------------------- ### PluginSetContext Constructor Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/plugincontext/PluginSetContext Details of the PluginSetContext constructor, used for initializing the plugin set context. ```APIDOC ## PluginSetContext Constructor ### Description Initializes a new instance of the `PluginSetContext` class. ### Method `public PluginSetContext(DynamicSet dynamicSet, PluginContext.PluginMetrics pluginMetrics)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "dynamicSet": "DynamicSet", "pluginMetrics": "PluginContext.PluginMetrics" } ``` ### Response #### Success Response (200) None (Constructor) #### Response Example None ``` -------------------------------- ### CanonicalWebUrlProvider Constructor and get() Method - Java Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/config/CanonicalWebUrlProvider This snippet shows the constructor and the primary get() method of the CanonicalWebUrlProvider class. The constructor accepts an org.eclipse.jgit.lib.Config object, and the get() method returns a String representing the canonical web URL. This class implements Provider interfaces from Guice and Jakarta. ```java /** * Provides `CanonicalWebUrl` from `gerrit.canonicalWebUrl`. */ public class CanonicalWebUrlProvider extends Object implements com.google.inject.Provider { /** * @Inject public CanonicalWebUrlProvider(org.eclipse.jgit.lib.Config config) */ @Inject public CanonicalWebUrlProvider(org.eclipse.jgit.lib.Config config) {} /** * Specified by: * `get` in interface `com.google.inject.Provider` * * Specified by: * `get` in interface `jakarta.inject.Provider` * * Specified by: * `get` in interface `javax.inject.Provider` * * public String get() */ public String get() { return null; // Placeholder for actual implementation } } ``` -------------------------------- ### Instantiate Plugins.ListRequest Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/extensions/api/plugins/Plugins Creates a new instance of the Plugins.ListRequest class. This is the starting point for building a plugin listing request. ```java public ListRequest() ``` -------------------------------- ### MailReceiver.start() Method Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/mail/receive/MailReceiver The start method, inherited from LifecycleListener, is invoked when the server is starting. It's a concrete method within the MailReceiver class. ```java public void start() Description copied from interface: `LifecycleListener` Invoked when the server is starting. Specified by: `start` in interface `LifecycleListener` ``` -------------------------------- ### ListGroups get Method Source: https://javadoc.io/doc/com.google.gerrit/gerrit-plugin-api/latest/com/google/gerrit/server/restapi/group/ListGroups The get method retrieves a list of GroupInfo objects. This method can throw an Exception if the retrieval process fails. ```java public List get() throws Exception ```