Class FSPackageRegistry
java.lang.Object
org.apache.jackrabbit.vault.packaging.registry.impl.AbstractPackageRegistry
org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry
- All Implemented Interfaces:
InternalPackageRegistry,PackageRegistry
FileSystem based registry not depending on a JCR Session. All metadata is stored in Filesystem and can be prepared and used without a running JCR repository
Only methods to install or uninstall packages require an active
Session object of running jcr instance to perform the actual installation tasks-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.jackrabbit.vault.packaging.registry.impl.AbstractPackageRegistry
AbstractPackageRegistry.SecurityConfig -
Field Summary
FieldsFields inherited from class org.apache.jackrabbit.vault.packaging.registry.impl.AbstractPackageRegistry
ARCHIVE_PACKAGE_ROOT_PATH, DEFAULT_PACKAGE_ROOT_PATH, DEFAULT_PACKAGE_ROOT_PATH_PREFIX, securityConfig -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for OSGi initialization (homeDir defined via activator)FSPackageRegistry(@NotNull File homeDir) Deprecated.FSPackageRegistry(@NotNull File homeDir, InstallationScope scope) Deprecated.FSPackageRegistry(@NotNull File homeDir, InstallationScope scope, AbstractPackageRegistry.SecurityConfig securityConfig) Deprecated.FSPackageRegistry(@NotNull File homeDir, InstallationScope scope, AbstractPackageRegistry.SecurityConfig securityConfig, boolean isStrict, boolean overwritePrimaryTypesOfFolders, IdConflictPolicy defaultIdConflictPolicy) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.framework.BundleContext context, org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry.Config config) @NotNull DependencyReportanalyzeDependencies(@NotNull PackageId id, boolean onlyInstalled) Creates a dependency report that lists the resolved and unresolved dependencies.booleanChecks if this registry contains the package with the given id.voiddispatch(PackageEvent.Type type, @NotNull PackageId id, @Nullable PackageId[] related) Dispatches a package event using the configured dispatcher.voidinstallPackage(@NotNull Session session, @NotNull RegisteredPackage pkg, @NotNull ImportOptions opts, boolean extract) @Nullable RegisteredPackageOpens the package with the given id.protected @NotNull VaultPackageopenPackageFile(@NotNull PackageId id) Opens the package of a file with the given Id.packages()Returns as set of all packages registered in this registry.@NotNull PackageIdRegisters a package provided via a file.@NotNull PackageIdregister(@NotNull InputStream in, boolean replace) Registers a package provided via an input stream.@NotNull PackageIdregisterExternal(@NotNull File file, boolean replace) Registers a package provided via an external file.voidRemoves the package from this registry.resolve(Dependency dependency, boolean onlyInstalled) Tries to resolve the given dependency and returns the id of the package that matches the dependency filter best.voidsetDispatcher(@Nullable PackageEventDispatcher dispatcher) Sets the event dispatchervoiduninstallPackage(@NotNull Session session, @NotNull RegisteredPackage pkg, @NotNull ImportOptions opts) Uninstallation not supported for FS based PackageRegistryprotected ZipVaultPackageupload(InputStream in, boolean replace) Methods inherited from class org.apache.jackrabbit.vault.packaging.registry.impl.AbstractPackageRegistry
createExecutionPlan, createRandomPid, getDefaultIdConflictPolicy, getRelativeInstallationPath, getSecurityConfig, isStrictByDefault, overwritePrimaryTypesOfFoldersByDefault, usage
-
Field Details
-
REPOSITORY_HOME
- See Also:
-
-
Constructor Details
-
FSPackageRegistry
Deprecated.Creates a new FSPackageRegistry based on the given home directory.- Parameters:
homeDir- the directory in which packages and their metadata is stored- Throws:
IOException- If an I/O error occurs.
-
FSPackageRegistry
@Deprecated public FSPackageRegistry(@NotNull @NotNull File homeDir, InstallationScope scope) throws IOException Deprecated.Creates a new FSPackageRegistry based on the given home directory.- Parameters:
homeDir- the directory in which packages and their metadata is storedscope- to set a corresponding workspacefilter- Throws:
IOException- If an I/O error occurs.
-
FSPackageRegistry
@Deprecated public FSPackageRegistry(@NotNull @NotNull File homeDir, InstallationScope scope, @Nullable AbstractPackageRegistry.SecurityConfig securityConfig) throws IOException Deprecated.- Parameters:
homeDir-scope-securityConfig-- Throws:
IOException
-
FSPackageRegistry
public FSPackageRegistry(@NotNull @NotNull File homeDir, InstallationScope scope, @Nullable AbstractPackageRegistry.SecurityConfig securityConfig, boolean isStrict, boolean overwritePrimaryTypesOfFolders, IdConflictPolicy defaultIdConflictPolicy) throws IOException - Throws:
IOException
-
FSPackageRegistry
Default constructor for OSGi initialization (homeDir defined via activator)- Throws:
IOException
-
-
Method Details
-
activate
public void activate(org.osgi.framework.BundleContext context, org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry.Config config) throws IOException - Throws:
IOException
-
setDispatcher
Sets the event dispatcher- Parameters:
dispatcher- the dispatcher.
-
dispatch
public void dispatch(@NotNull PackageEvent.Type type, @NotNull @NotNull PackageId id, @Nullable @Nullable PackageId[] related) Dispatches a package event using the configured dispatcher.- Parameters:
type- event typeid- package idrelated- related packages
-
open
@Nullable public @Nullable RegisteredPackage open(@NotNull @NotNull PackageId id) throws IOException Description copied from class:AbstractPackageRegistryOpens the package with the given id.- Specified by:
openin interfacePackageRegistry- Specified by:
openin classAbstractPackageRegistry- Parameters:
id- the package id- Returns:
- the package or
nullif it does not exists. - Throws:
IOException- if an I/O error occurs.
-
contains
Description copied from class:AbstractPackageRegistryChecks if this registry contains the package with the given id.- Specified by:
containsin interfacePackageRegistry- Specified by:
containsin classAbstractPackageRegistry- Parameters:
id- the package id.- Returns:
trueif the package is registered.- Throws:
IOException- if an I/O error occurs.
-
openPackageFile
@NotNull protected @NotNull VaultPackage openPackageFile(@NotNull @NotNull PackageId id) throws IOException, NoSuchPackageException Opens the package of a file with the given Id.- Parameters:
id- The Id of package file.- Returns:
- the package
- Throws:
IOException- if an I/O error occurs.NoSuchPackageException
-
analyzeDependencies
@NotNull public @NotNull DependencyReport analyzeDependencies(@NotNull @NotNull PackageId id, boolean onlyInstalled) throws IOException, NoSuchPackageException Creates a dependency report that lists the resolved and unresolved dependencies.- Specified by:
analyzeDependenciesin interfacePackageRegistry- Overrides:
analyzeDependenciesin classAbstractPackageRegistry- Parameters:
id- the package id.onlyInstalled- iftrueonly installed packages are used for resolution- Returns:
- the report
- Throws:
IOException- if an error accessing the repository occurrsNoSuchPackageException- if the package with the giveniddoes not exist.
-
resolve
Tries to resolve the given dependency and returns the id of the package that matches the dependency filter best.- Specified by:
resolvein interfacePackageRegistry- Specified by:
resolvein classAbstractPackageRegistry- Parameters:
dependency- the dependency to resolve against.onlyInstalled- iftrueonly installed packages are respected.- Returns:
- the package id or
null - Throws:
IOException- if an I/O error occurrs.
-
register
@NotNull public @NotNull PackageId register(@NotNull @NotNull InputStream in, boolean replace) throws IOException, PackageExistsException Registers a package provided via an input stream. The method fails, if a package with the same id already exists, andreplaceis set tofalse. otherwise the existing package is replaced.- Specified by:
registerin interfacePackageRegistry- Specified by:
registerin classAbstractPackageRegistry- Parameters:
in- the input stream to the package datareplace-trueif existing package should be replaced.- Returns:
- the new package id.
- Throws:
IOException- if an I/O error occurs.PackageExistsException- if the package exists andreplaceisfalse.
-
upload
protected ZipVaultPackage upload(InputStream in, boolean replace) throws IOException, PackageExistsException - Throws:
IOExceptionPackageExistsException
-
register
@NotNull public @NotNull PackageId register(@NotNull @NotNull File file, boolean replace) throws IOException, PackageExistsException Registers a package provided via a file. The method fails, if a package with the same id already exists, andreplaceis set tofalse; otherwise the existing package is replaced.- Specified by:
registerin interfacePackageRegistry- Specified by:
registerin classAbstractPackageRegistry- Parameters:
file- the file to the package datareplace-trueif existing package should be replaced.- Returns:
- the new package id.
- Throws:
IOException- if an I/O error occurrs.PackageExistsException- if the package exists andreplaceisfalse.
-
registerExternal
@NotNull public @NotNull PackageId registerExternal(@NotNull @NotNull File file, boolean replace) throws IOException, PackageExistsException Description copied from class:AbstractPackageRegistryRegisters a package provided via an external file. The binary data of the package will not be copied into the underlying persistence but only be referenced. Removing such a linked package afterwards will not delete the original file. The method fails, if a package with the same id already exists, andreplaceis set tofalse; otherwise the existing package is replaced.- Specified by:
registerExternalin interfacePackageRegistry- Specified by:
registerExternalin classAbstractPackageRegistry- Parameters:
file- the file to the package data.replace-trueif existing package should be replaced.- Returns:
- the new package id.
- Throws:
IOException- if an I/O error occurrs.PackageExistsException- if the package exists andreplaceisfalse.
-
remove
Removes the package from this registry.- Specified by:
removein interfacePackageRegistry- Specified by:
removein classAbstractPackageRegistry- Parameters:
id- the id of the package to remove- Throws:
IOException- if an I/O error occurrs.NoSuchPackageException- if the package does not exist
-
packages
Returns as set of all packages registered in this registry.- Specified by:
packagesin interfacePackageRegistry- Specified by:
packagesin classAbstractPackageRegistry- Returns:
- a set of package ids.
- Throws:
IOException- if an I/O error occurs.
-
installPackage
public void installPackage(@NotNull @NotNull Session session, @NotNull @NotNull RegisteredPackage pkg, @NotNull @NotNull ImportOptions opts, boolean extract) throws IOException, PackageException - Specified by:
installPackagein interfaceInternalPackageRegistry- Specified by:
installPackagein classAbstractPackageRegistry- Throws:
IOExceptionPackageException
-
uninstallPackage
public void uninstallPackage(@NotNull @NotNull Session session, @NotNull @NotNull RegisteredPackage pkg, @NotNull @NotNull ImportOptions opts) throws IOException, PackageException Uninstallation not supported for FS based PackageRegistry- Specified by:
uninstallPackagein interfaceInternalPackageRegistry- Specified by:
uninstallPackagein classAbstractPackageRegistry- Throws:
IOExceptionPackageException
-
FSPackageRegistry(File, InstallationScope, SecurityConfig, boolean, boolean, IdConflictPolicy)instead