Class PackageRegistriesImpl.RegistriesImpl
- java.lang.Object
-
- com.composum.sling.core.pckgmgr.regpckg.service.impl.PackageRegistriesImpl.RegistriesImpl
-
- All Implemented Interfaces:
PackageRegistries.Registries
- Enclosing class:
- PackageRegistriesImpl
public class PackageRegistriesImpl.RegistriesImpl extends Object implements PackageRegistries.Registries
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,org.apache.jackrabbit.vault.packaging.registry.PackageRegistry>registriesprotected org.apache.sling.api.resource.ResourceResolverresolver
-
Constructor Summary
Constructors Constructor Description RegistriesImpl(org.apache.sling.api.resource.ResourceResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadd(org.apache.jackrabbit.vault.packaging.registry.PackageRegistry registry)Collection<String>getNamespaces()org.apache.jackrabbit.vault.packaging.registry.PackageRegistrygetRegistry(String namespaceOrPath)Gives thePackageRegistryfor a namespace (e.g.Collection<org.apache.jackrabbit.vault.packaging.registry.PackageRegistry>iterable()org.apache.commons.lang3.tuple.Pair<String,org.apache.jackrabbit.vault.packaging.registry.RegisteredPackage>open(org.apache.jackrabbit.vault.packaging.PackageId id)Opens aRegisteredPackage- remember to close it (AutoCloseable).protected org.apache.jackrabbit.vault.packaging.DependencypathToDependency(String path)Creates a matcher from eithergroup/packageorgroup/package/version.org.apache.commons.lang3.tuple.Pair<String,org.apache.jackrabbit.vault.packaging.PackageId>resolve(String rawPath)Finds the namespace and package that matches the given path.org.apache.commons.lang3.tuple.Pair<String,org.apache.jackrabbit.vault.packaging.PackageId>resolve(String namespace, org.apache.jackrabbit.vault.packaging.PackageId packageId)Checks whether there is actually package with that id in the registry, looking through the registries if no namespace is given.org.apache.commons.lang3.tuple.Pair<org.apache.jackrabbit.vault.packaging.registry.PackageRegistry,org.apache.jackrabbit.vault.packaging.PackageId>resolve(org.apache.jackrabbit.vault.packaging.Dependency dependency, boolean onlyInstalled)Finds the bestPackageIdthat matches the dependency filter, if there is one.
-
-
-
Method Detail
-
iterable
@Nonnull public Collection<org.apache.jackrabbit.vault.packaging.registry.PackageRegistry> iterable()
- Specified by:
iterablein interfacePackageRegistries.Registries
-
getNamespaces
@Nonnull public Collection<String> getNamespaces()
- Specified by:
getNamespacesin interfacePackageRegistries.Registries
-
getRegistry
@Nullable public org.apache.jackrabbit.vault.packaging.registry.PackageRegistry getRegistry(@Nonnull String namespaceOrPath)
Description copied from interface:PackageRegistries.RegistriesGives thePackageRegistryfor a namespace (e.g. @fs) or a path starting with a namespace ( e.g. /@fs/some/thing). If the path does not have an explicit namespace (e.g. mixed view) but matches a package / package version in one of the registries, we return that registry; if there are more than one, we return the registry with the highest version, as this one is probably most interesting.- Specified by:
getRegistryin interfacePackageRegistries.Registries
-
resolve
@Nullable public org.apache.commons.lang3.tuple.Pair<String,org.apache.jackrabbit.vault.packaging.PackageId> resolve(@Nullable String rawPath) throws IOException
Description copied from interface:PackageRegistries.RegistriesFinds the namespace and package that matches the given path. If the path doesn't encode the version, we return the package with the highest version. If there is no namespace given (merged mode), we search the registries.- Specified by:
resolvein interfacePackageRegistries.Registries- Throws:
IOException
-
pathToDependency
@Nullable protected org.apache.jackrabbit.vault.packaging.Dependency pathToDependency(@Nonnull String path)
Creates a matcher from eithergroup/packageorgroup/package/version.
-
resolve
@Nullable public org.apache.commons.lang3.tuple.Pair<org.apache.jackrabbit.vault.packaging.registry.PackageRegistry,org.apache.jackrabbit.vault.packaging.PackageId> resolve(@Nonnull org.apache.jackrabbit.vault.packaging.Dependency dependency, boolean onlyInstalled) throws IOException
Description copied from interface:PackageRegistries.RegistriesFinds the bestPackageIdthat matches the dependency filter, if there is one.- Specified by:
resolvein interfacePackageRegistries.Registries- Throws:
IOException
-
open
@Nullable public org.apache.commons.lang3.tuple.Pair<String,org.apache.jackrabbit.vault.packaging.registry.RegisteredPackage> open(@Nonnull org.apache.jackrabbit.vault.packaging.PackageId id) throws IOException
Description copied from interface:PackageRegistries.RegistriesOpens aRegisteredPackage- remember to close it (AutoCloseable). As additional information we return the namespace where it was found.- Specified by:
openin interfacePackageRegistries.Registries- Throws:
IOException
-
resolve
@Nullable public org.apache.commons.lang3.tuple.Pair<String,org.apache.jackrabbit.vault.packaging.PackageId> resolve(@Nullable String namespace, @Nullable org.apache.jackrabbit.vault.packaging.PackageId packageId) throws IOException
Description copied from interface:PackageRegistries.RegistriesChecks whether there is actually package with that id in the registry, looking through the registries if no namespace is given. If package wasn't found, this returns null.- Specified by:
resolvein interfacePackageRegistries.Registries- Throws:
IOException
-
add
protected void add(@Nullable org.apache.jackrabbit.vault.packaging.registry.PackageRegistry registry)
-
-