Skip to content

Repository_First_Version

sitMCella edited this page Aug 19, 2022 · 3 revisions

The first version of the Command Line Interface application works on the first version of the Jackrabbit Oak repository structure.

Repository

The Jackrabbit Oak repository configuration file is located in "repository-first-version/src/main.resources/cnd.config".

Configuration

Configure the absolute path where to store the Jackrabbit Oak repository. Use the configuration file located in "Jackrabbit-Oak-repository-upgrade/app-run-first-version/src/main/resources/settings.properties"

Build the project

Execute the following command.

mvn clean install

Run the application

Execute the following commands.

cd app-run-first-version/target
java -jar app-run-first-version-1.0-SNAPSHOT.jar

Explore Repository

JackRabbit Oak provides a Graphical Interface tool for exploring the repository.

Download the JAR package oak-run-1.6.22.jar from https://search.maven.org/artifact/org.apache.jackrabbit/oak-run/1.6.22/jar

Execute the following command.

java -jar oak-run-1.6.22.jar explore /path/to/oak-repository/repository

Command Line Interface

After the Jackrabbit Oak repository has been fully initialized, the following log message will appear in the terminal.

[main] INFO it.mcella.jcr.oak.upgrade.repository.OakRepository - Oak repository initialization complete

Action Help

The Action Help section will appear in the terminal during the first login.

Action [help]: 

Actions:
quit                  application exit
help                  print this help
setup                 initialize the repository with a predefined node structure
list                  list all repository nodes and versions
create-folder         create folder
create-file           create file
create-file-version   create file version
retrieve-file         retrieve file or file version content

The Action Help section will appear also typing "help" or pressing Enter without action selection.

List Action

The List action shows in the terminal the complete list of nodes created inside the repository.

During the first initialization of a new Jackrabbit Oak repository, the application will create a Root Node with jcrNodeId "/".

Action [help]: list
RootNode{jcrNodeId='/', jcrNodePath='/', name='', childNodeIds='[OakNodeId{nodeId='/oak:index'}, OakNodeId{nodeId='/jcr:system'}, OakNodeId{nodeId='/rep:security'}]'}

Quit

The Quit action will gracefully close the Jackrabbit Oak repository and will terminate the application.

Create Folder

The Create Folder action is used for creating a Node of type Folder inside the repository.

The parameters to configure are the following:

  • Parent Node ID: the "jcrNodeId" of the parent node.
  • Folder Name: the name of the folder (any alphanumeric characters are allowed).
  • Hidden: attribute that defines the Folder Node as hidden.

The following is an example of Folder Node.

Action [help]: create-folder
Parent Node ID: /
Folder Name: manifacturing
Hidden: false
[main] INFO it.mcella.jcr.oak.upgrade.repository.firstversion.persistence.folder.FolderPersistence - Created folder: FolderNode{jcrNodeId='f5b48075-39dc-4694-ab9c-ce36a7b8535b', jcrNodePath='/manifacturing', name='manifacturing', hidden=false, childNodeIds='[]'}

The following is the example content of a Folder Node.

Folder

Create File

The Create File action is used for creating a Node of type File inside the repository.

The parameters to configure are the following:

  • Parent Node ID: the "jcrNodeId" of the parent node.
  • File Name: the name of the file (any alphanumeric characters are allowed).
  • Hidden: attribute that defines the File Node as hidden.
  • Deletable: attribute that defines the File Node as deletable.
  • File Path: the absolute path of the file to upload.

The following is an example of File Node.

Action [help]: create-file
Parent Node ID: f5b48075-39dc-4694-ab9c-ce36a7b8535b
File Name: 43926296
Hidden: true
Deletable: true
File Path: /path/to/43926296.rtf
[main] INFO it.mcella.jcr.oak.upgrade.repository.firstversion.persistence.file.FilePersistence - Created file: FileNode{jcrNodeId='42797121-9bde-4320-847f-54c579961120', jcrNodePath='/manifacturing/43926296', name='43926296', hidden=true, deletable=true, mimeType='text/rtf'}

The following is the example content of a File Node.

File

Create File Version

The Create File Version action is used for creating a Node of type File Version inside the repository. A File Version Node is created from a File Node.

In case that the File Node does not have any versions associated, then the Create File Version action will create also a first File Version Node with the content of the original File Node.

The parameters to configure are the following:

  • File Node ID: the "jcrNodeId" of the File Node.
  • File Path: the absolute path of the file to upload.
  • Description: attribute that defines the description to apply to the file version.

The following is an example of File Version Node.

Action [help]: create-file-version
File Node ID: 42797121-9bde-4320-847f-54c579961120
File Path: /path/to/43926296.rtf
Description: parachute v1
[main] INFO it.mcella.jcr.oak.upgrade.repository.firstversion.persistence.file.FileVersionPersistence - Created file version: FileVersionNode{jcrNodeId='0132b691-aed6-4339-810d-6012fb38108b', jcrNodePath='/manifacturing/43926296', name='43926296', hidden=false, deletable=true, mimeType='text/rtf', versionNumber=1, versionDescription=''}
[main] INFO it.mcella.jcr.oak.upgrade.repository.firstversion.persistence.file.FileVersionPersistence - Created file version: FileVersionNode{jcrNodeId='817db1d9-57f8-4880-95d9-dafd555d951a', jcrNodePath='/manifacturing/43926296', name='43926296', hidden=false, deletable=true, mimeType='text/rtf', versionNumber=2, versionDescription='parachute v1'}

The following is the example content of a File Version Node.

File Version