Package io.quarkus.cli.plugin
Class CatalogService<T extends Catalog<T>>
java.lang.Object
io.quarkus.cli.plugin.CatalogService<T>
- Direct Known Subclasses:
JBangCatalogService,PluginCatalogService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.fasterxml.jackson.databind.ObjectMapperprotected static final Path -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the project catalog path relative to the specified path.findProjectRoot(Path dir) Get the project root of the specified path.getCatalogPath(Optional<Path> projectDir, Optional<Path> userDir) Get the project or user catalog path.Get the catalog relative to the specified path.Get the catalog relative to the current dir.Get the global catalog path that is under `~/.quarkus/cli/plugins/catalog.json`getUserCatalogPath(Optional<Path> userDir) Get the global catalog path that is under `.quarkus/cli/plugins/catalog.json` under the specified user home directory.readCatalog(Path path) Read the catalog from the specified path.readCatalog(Optional<Path> projectDir, Optional<Path> userDir) Read the catalog from project or fallback to global catalog.readProjectCatalog(Optional<Path> dir) readUserCatalog(Optional<Path> userDir) Reads the plguin catalog from the user home.voidwriteCatalog(T catalog) Write the catalog to the specifiedPath.
-
Field Details
-
USER_HOME
-
EXISTS_AND_WRITABLE
-
IS_USER_HOME
-
IS_ELIGIBLE_PROJECT_ROOT
-
HAS_POM_XML
-
HAS_BUILD_GRADLE
-
GIT_ROOT
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper -
catalogType
-
projectRoot
-
relativePath
-
-
Constructor Details
-
CatalogService
-
-
Method Details
-
readUserCatalog
Reads the plguin catalog from the user home.- Parameters:
userdir- An optional path pointing to the user directory.- Returns:
- a catalog wrapped in optional or empty if the catalog is not present.
-
readProjectCatalog
-
findProjectCatalogPath
Get the project catalog path relative to the specified path. The method will traverse from the specified path up to upmost directory that the user can write and is under version control seeking for a `.quarkus/cli/plugins/catalog.json`.- Parameters:
dir- the specified path- Returns:
- the catalog path wrapped as
Optionalor empty if the catalog does not exist.
-
findProjectCatalogPath
-
readCatalog
Read the catalog from project or fallback to global catalog.- Parameters:
projectDir- An optional path pointing to the project directory.userdir- An optional path pointing to the user directory- Returns:
- the catalog
-
readCatalog
Read the catalog from the specified path.- Parameters:
path- the path to read the catalog from.- Returns:
- the catalog
-
writeCatalog
Write the catalog to the specifiedPath. The method will create the directory structure if missing.- Parameters:
catalog- the catalogpath- the path
-
getUserCatalogPath
Get the global catalog path that is under `.quarkus/cli/plugins/catalog.json` under the specified user home directory. The specified directory is optional and the method will fallback to the `user.home` system property. Using a different value if mostly needed for testing.- Parameters:
userDir- An optional user directory to use as a base path for the catalog lookup- Returns:
- the catalog path wrapped as
Optionalor empty if the catalog does not exist.
-
getUserCatalogPath
Get the global catalog path that is under `~/.quarkus/cli/plugins/catalog.json`- Returns:
- the catalog path wrapped as
Optionalor empty if the catalog does not exist.
-
getRelativeCatalogPath
Get the catalog relative to the specified path.- Parameters:
dir- the specified path- Returns:
- the catalog path wrapped as
Optionalor empty if the catalog does not exist.
-
getRelativeCatalogPath
Get the catalog relative to the current dir.- Parameters:
output- anthat can be used for tests to substitute current dir with a test directory.invalid reference
OutputOptionMixin- Returns:
- the catalog path wrapped as
Optionalor empty if the catalog does not exist.
-
getCatalogPath
Get the project or user catalog path. The method with lookup the relative catalog path to the current dir and will fallback to the user catalog path.- Parameters:
projectDir- An optional path pointing to the project directory.userdir- An optional path pointing to the user directory- Returns:
- the catalog path wrapped as
Optionalor empty if the catalog does not exist.
-
findProjectRoot
Get the project root of the specified path. The method will traverse from the specified path up to upmost directory that the user can write and is under version control.- Parameters:
dir- the specified path- Returns:
- the project path wrapped as
Optionalor empty if the catalog does not exist.
-