How to delete a JCR workspace

This page explains how to delete a JCR workspace on a Magnolia system.

JCR API and Jackrabbit

You cannot delete a JCR workspace programmatically with Magnolia. You must delete it manually.

Apache Jackrabbit, which is the JCR implementation used by Magnolia, doesn’t implement the #deleteWorkpace method defined in the JCR 2.0 API (see javax.jcr.Workspace).

org.apache.jackrabbit.core.WorkspaceImpl#delete
public void deleteWorkspace(String name) throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException {
  this.context.getRepository().getWorkspaceInfo(name);
  this.context.getAccessManager().checkRepositoryPermission(32768);
  throw new UnsupportedRepositoryOperationException("not yet implemented");
}

Deleting a workspace manually

Before starting:

  • Note that deletion cannot be reverted.

  • Ensure that the workspace you want to delete doesn’t contain content you still require.

  • Shut down the application server (such as Tomcat) before manually deleting. You can’t delete a workspace on a running system.

Overview

There are two main steps involved in deleting a workspace manually:

  1. Delete the folder $magnolia.repositories.home/magnolia/workspaces/$workspace-name.

  2. Delete database tables with table names containing the workspace name.

On embedded databases such as H2, you can skip step 2.

Deleting the workspace folder in the repository folder

For every JCR workspace, there is a folder on the file system. The value of the magnolia.repositories.home property defines the location of these folders.

  1. Check the value for your system:

    1. If your system is still running, use the About app to look up the property.

    2. Alternatively, check the magnolia.properties files where the property is defined.

  2. Determine the path for $magnolia.repositories.home/magnolia/workspaces/$workspace-name and delete the folder.

Table 1. Example

magnolia.repositories.home

/var/lib/author/tomcat/webapps/author/repositories

Workspace name

dms

Folder to delete

/var/lib/author/tomcat/webapps/author/repositories/magnolia/workspaces/dms

Deleting database tables

You should delete all tables which contain the JCR workspace name.

Your approach when deleting these tables depends on the persistence layer. Some examples of persistence layers are:

The value of the Magnolia property magnolia.repositories.jackrabbit.config gives an indication of the persistence layer in use.

Table 2. Example

Jackrabbit persistence layer

MySQL (Version 14.14, Distribution 5.7.20, for Linux (x86_64))

Workspace name

dms

Table names in MySQL DB

PM_DMS_BINVAL, PM_DMS_BUNDLE, PM_DMS_NAMES, PM_DMS_REFS

Multiple instances and clustering

Depending on how your Magnolia instances are set up and if you use clustering, you must delete a workspace in one or several locations.

Make sure you delete the workspace on both the author instance and on all public instances.
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules