Title: | Connectivity to 'Alfresco' Content Management Repositories |
---|---|
Description: | Allows you to connect to an 'Alfresco' content management repository and interact with its contents using simple and intuitive functions. You will be able to establish a connection session to the 'Alfresco' repository, read and upload content and manage folder hierarchies. For more details on the 'Alfresco' content management repository see <https://www.alfresco.com/ecm-software/document-management>. |
Authors: | Roy Wetherall <[email protected]> |
Maintainer: | Roy Wetherall <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 1.3.0.9000 |
Built: | 2025-02-02 03:41:00 UTC |
Source: | https://github.com/rwetherall/alfr |
Gets the details of an Alfresco repository node matching node_id
or, if provided, the node at relative_path
relative to node_id
.
alf_node(session, node_id = "-root-", relative_path = NULL)
alf_node(session, node_id = "-root-", relative_path = NULL)
session |
valid Alfresco repository session |
node_id |
node id, defaults to |
relative_path |
relative path from |
Node details
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # create document my_new_document <- alf_node.new(my_session, node_id="-root-", list( name = "example.txt", nodeType = "cm:content", relativePath = "example" )) # upload content my_new_document$content$update( system.file("extdata", "sample.txt", package="alfr")) # get details of document node my_document <- alf_node(my_session, relative_path = "example/example.txt") # output the name of the document print(my_document$name) # output the details of documents content print(my_document$content$mime_type) print(my_document$content$mime_type_name) print(my_document$content$size) print(my_document$content$encoding) # read document content my_content_file <- file(my_document$content$as.file(), "r") my_content <- readLines(my_content_file) close(my_content_file) print(my_content) # upload new content my_updated_document <- my_document$content$update( system.file("extdata", "modified_sample.txt", package="alfr")) # print updated content size print(my_updated_document$content$size) # delete document alf_node.delete(my_session, my_document$id) }
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # create document my_new_document <- alf_node.new(my_session, node_id="-root-", list( name = "example.txt", nodeType = "cm:content", relativePath = "example" )) # upload content my_new_document$content$update( system.file("extdata", "sample.txt", package="alfr")) # get details of document node my_document <- alf_node(my_session, relative_path = "example/example.txt") # output the name of the document print(my_document$name) # output the details of documents content print(my_document$content$mime_type) print(my_document$content$mime_type_name) print(my_document$content$size) print(my_document$content$encoding) # read document content my_content_file <- file(my_document$content$as.file(), "r") my_content <- readLines(my_content_file) close(my_content_file) print(my_content) # upload new content my_updated_document <- my_document$content$update( system.file("extdata", "modified_sample.txt", package="alfr")) # print updated content size print(my_updated_document$content$size) # delete document alf_node.delete(my_session, my_document$id) }
Deletes an Alfresco node identified by node_id
. If the node is a folder then all the
delete recurses through the primary children.
alf_node.delete(session, node_id, permanent = FALSE)
alf_node.delete(session, node_id, permanent = FALSE)
session |
valid Alfresco repository session |
node_id |
node id to delete |
permanent |
indicates whether the node is permanently deleted or places in the trashcan where
where it can be recovered from. |
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # create document my_new_document <- alf_node.new(my_session, node_id="-root-", list( name = "example.txt", nodeType = "cm:content", relativePath = "example" )) # upload content my_new_document$content$update( system.file("extdata", "sample.txt", package="alfr")) # get details of document node my_document <- alf_node(my_session, relative_path = "example/example.txt") # output the name of the document print(my_document$name) # output the details of documents content print(my_document$content$mime_type) print(my_document$content$mime_type_name) print(my_document$content$size) print(my_document$content$encoding) # read document content my_content_file <- file(my_document$content$as.file(), "r") my_content <- readLines(my_content_file) close(my_content_file) print(my_content) # upload new content my_updated_document <- my_document$content$update( system.file("extdata", "modified_sample.txt", package="alfr")) # print updated content size print(my_updated_document$content$size) # delete document alf_node.delete(my_session, my_document$id) }
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # create document my_new_document <- alf_node.new(my_session, node_id="-root-", list( name = "example.txt", nodeType = "cm:content", relativePath = "example" )) # upload content my_new_document$content$update( system.file("extdata", "sample.txt", package="alfr")) # get details of document node my_document <- alf_node(my_session, relative_path = "example/example.txt") # output the name of the document print(my_document$name) # output the details of documents content print(my_document$content$mime_type) print(my_document$content$mime_type_name) print(my_document$content$size) print(my_document$content$encoding) # read document content my_content_file <- file(my_document$content$as.file(), "r") my_content <- readLines(my_content_file) close(my_content_file) print(my_content) # upload new content my_updated_document <- my_document$content$update( system.file("extdata", "modified_sample.txt", package="alfr")) # print updated content size print(my_updated_document$content$size) # delete document alf_node.delete(my_session, my_document$id) }
Creates a new Alfresco repository node as a child of node_id
.
alf_node.new(session, node_id, node_details)
alf_node.new(session, node_id, node_details)
session |
valid Alfresco repository session |
node_id |
node id |
node_details |
details of new node |
node details
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # create document my_new_document <- alf_node.new(my_session, node_id="-root-", list( name = "example.txt", nodeType = "cm:content", relativePath = "example" )) # upload content my_new_document$content$update( system.file("extdata", "sample.txt", package="alfr")) # get details of document node my_document <- alf_node(my_session, relative_path = "example/example.txt") # output the name of the document print(my_document$name) # output the details of documents content print(my_document$content$mime_type) print(my_document$content$mime_type_name) print(my_document$content$size) print(my_document$content$encoding) # read document content my_content_file <- file(my_document$content$as.file(), "r") my_content <- readLines(my_content_file) close(my_content_file) print(my_content) # upload new content my_updated_document <- my_document$content$update( system.file("extdata", "modified_sample.txt", package="alfr")) # print updated content size print(my_updated_document$content$size) # delete document alf_node.delete(my_session, my_document$id) }
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # create document my_new_document <- alf_node.new(my_session, node_id="-root-", list( name = "example.txt", nodeType = "cm:content", relativePath = "example" )) # upload content my_new_document$content$update( system.file("extdata", "sample.txt", package="alfr")) # get details of document node my_document <- alf_node(my_session, relative_path = "example/example.txt") # output the name of the document print(my_document$name) # output the details of documents content print(my_document$content$mime_type) print(my_document$content$mime_type_name) print(my_document$content$size) print(my_document$content$encoding) # read document content my_content_file <- file(my_document$content$as.file(), "r") my_content <- readLines(my_content_file) close(my_content_file) print(my_content) # upload new content my_updated_document <- my_document$content$update( system.file("extdata", "modified_sample.txt", package="alfr")) # print updated content size print(my_updated_document$content$size) # delete document alf_node.delete(my_session, my_document$id) }
Validates authentication details with Alfresco content repository, returning ticket, server details and endpoints if successful.
alf_session(server, username, password)
alf_session(server, username, password)
server |
Alfresco server URL |
username |
user name |
password |
password |
Connection session to Alfresco repository
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # output session information print(paste("Session: [ticket = ", my_session$ticket, ", server = ", my_session$server, "]", sep="")) # verify that the session is valid if (alf_session.is_valid(my_session)) print("Session verified as valid.") # invalidate the session so that it can no longer be used alf_session.invalidate(my_session) }
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # output session information print(paste("Session: [ticket = ", my_session$ticket, ", server = ", my_session$server, "]", sep="")) # verify that the session is valid if (alf_session.is_valid(my_session)) print("Session verified as valid.") # invalidate the session so that it can no longer be used alf_session.invalidate(my_session) }
Invalidates a valid session so it can no longer be used to connect to an Alfresco repository.
alf_session.invalidate(session)
alf_session.invalidate(session)
session |
session |
TRUE
if session has been successfully invalidated, FALSE
if session was
already invalid.
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # output session information print(paste("Session: [ticket = ", my_session$ticket, ", server = ", my_session$server, "]", sep="")) # verify that the session is valid if (alf_session.is_valid(my_session)) print("Session verified as valid.") # invalidate the session so that it can no longer be used alf_session.invalidate(my_session) }
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # output session information print(paste("Session: [ticket = ", my_session$ticket, ", server = ", my_session$server, "]", sep="")) # verify that the session is valid if (alf_session.is_valid(my_session)) print("Session verified as valid.") # invalidate the session so that it can no longer be used alf_session.invalidate(my_session) }
Determines whether a given session is still valid or not.
alf_session.is_valid(session)
alf_session.is_valid(session)
session |
session |
TRUE
if the session is valid, FALSE
otherwise
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # output session information print(paste("Session: [ticket = ", my_session$ticket, ", server = ", my_session$server, "]", sep="")) # verify that the session is valid if (alf_session.is_valid(my_session)) print("Session verified as valid.") # invalidate the session so that it can no longer be used alf_session.invalidate(my_session) }
# try to establish a connection to the alfresco content repository my_session <- tryCatch( alf_session("http://localhost:8080", "admin", "admin"), error = function(e) NULL) if (!is.null(my_session)) { # output session information print(paste("Session: [ticket = ", my_session$ticket, ", server = ", my_session$server, "]", sep="")) # verify that the session is valid if (alf_session.is_valid(my_session)) print("Session verified as valid.") # invalidate the session so that it can no longer be used alf_session.invalidate(my_session) }
The alfr
package provides a way to connect to Alfresco and interact with the contents of the repository.
Session
alf_session
- connection session to an Alfresco repository
alf_session.is_valid
- determine whether the session connection to an Alfresco repository is still valid
alf_session.invalidate
- invalidates a session so it can no longer use used to connect to an Alfresco repository
Nodes
alf_node
- get the details of a folder or content node
alf_node.new
- creates a new folder or content node
alf_node.delete
- deletes a folder or content node
Roy Wetherall [email protected]