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>
registries
protected org.apache.sling.api.resource.ResourceResolver
resolver
-
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 void
add(org.apache.jackrabbit.vault.packaging.registry.PackageRegistry registry)
Collection<String>
getNamespaces()
org.apache.jackrabbit.vault.packaging.registry.PackageRegistry
getRegistry(String namespaceOrPath)
Gives thePackageRegistry
for 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.Dependency
pathToDependency(String path)
Creates a matcher from eithergroup/package
orgroup/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 bestPackageId
that matches the dependency filter, if there is one.
-
-
-
Method Detail
-
iterable
@Nonnull public Collection<org.apache.jackrabbit.vault.packaging.registry.PackageRegistry> iterable()
- Specified by:
iterable
in interfacePackageRegistries.Registries
-
getNamespaces
@Nonnull public Collection<String> getNamespaces()
- Specified by:
getNamespaces
in interfacePackageRegistries.Registries
-
getRegistry
@Nullable public org.apache.jackrabbit.vault.packaging.registry.PackageRegistry getRegistry(@Nonnull String namespaceOrPath)
Description copied from interface:PackageRegistries.Registries
Gives thePackageRegistry
for 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:
getRegistry
in 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.Registries
Finds 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:
resolve
in interfacePackageRegistries.Registries
- Throws:
IOException
-
pathToDependency
@Nullable protected org.apache.jackrabbit.vault.packaging.Dependency pathToDependency(@Nonnull String path)
Creates a matcher from eithergroup/package
orgroup/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.Registries
Finds the bestPackageId
that matches the dependency filter, if there is one.- Specified by:
resolve
in 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.Registries
Opens aRegisteredPackage
- remember to close it (AutoCloseable). As additional information we return the namespace where it was found.- Specified by:
open
in 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.Registries
Checks 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:
resolve
in interfacePackageRegistries.Registries
- Throws:
IOException
-
add
protected void add(@Nullable org.apache.jackrabbit.vault.packaging.registry.PackageRegistry registry)
-
-