CMIS讲解

news/2024/10/26 15:19:32/

在工作中,利用CMIS来进行文档传输与管理,例如前端选择一个文件,基于CMIS协议,将这个文件上传到后端Repository上,同时前段也可以查询文件和对文件进行版本控制和权限控制。

什么是CMIS

CMIS(Content Management Interoperability Services)

The Content Management Interoperability Services (CMIS) standard defines a domain model and Web Services, Restful AtomPub and browser (JSON) bindings that can be used by applications to work with one or more Content Management repositories/systems.

在这里,我们可以CMIS是一种标准来进行内容管理,在本文中,我们主要用CMIS管理非结构的数据。关于Web Services, Restful AtomPub and browser (JSON) bindings 这些在下文会说,

CMIS基本概念

CMIS是基于Data Model和Service的。Data Model是一系列的实体,Service就是对这些实体的操作。

Data Model有下面的一些内容:

  • Repository
  • Object
  • Object-Type
  • Document Object
  • Folder Object
  • Relationship Object
  • Policy Object
  • Item Object
  • Secondary Object-Types
  • Object-Type Creation, Modification and Deletion
  • Access Control
  • Versioning
  • Query
  • Change Log
  • Retentions and Holds

Service就是对上面Data Model的CRUD操作。方法比较多这里只能举个例子:

  • getRepositoryInfo
  • createDocument
  • deleteObject
  • applyACL
  • getACL

CMIS实现

在定义中,我们就已经提到了Binding一词,AtomPub Binding, Web Services BindingBrowser Binding,这就是3种实现方式,那么到底什么是Binding呢?这里的Binding其实是Protocol Binding:

Protocol binding is the connection between one protocol and another in a network to create a new data flow. In communications networks, data flows between protocols, such as the transport protocol and network protocol, as it is forwarded from a source to a destination. Binding the protocols creates the channel used by the data as it moves from the original application through the network.

好吧,有点难懂,简单说就是把一个协议和另一个协议绑定在一起,用于数据传输,这2种协议要在不同的层上面。

这里我们主要介绍Browser Binding

The CMIS Browser Binding is based upon JSON (Java Script Object Notation, [RFC4627]) and patterns used in Web applications. This binding is specifically designed to support applications running in a web browser but is not restricted to them. It is based on technologies that developers who build such applications already understand, including HTML, HTML Forms, JavaScript and JSON (Java Script Object Notation). Importantly, it does not require a JavaScript library, but rather takes advantage of capabilities already built into modern browsers.

Browser Binding主要是基于浏览器设置的Binding,同时数据的传输都是JSON格式,而且不需要任何的JS库。

这里说一下Browser Binding是基于HTTP协议的,也就是将CMIS与HTTP进行了Protocol Binding,而且由于不是REST形式,只有GETPOST2种方法。用GET的方法在CMIS的叫selector,而POST的方法在CMIS叫action.

说了这么多,举个例子吧:

GET https://host/b7579290-68c7-44b6-b135-2b5150e7c434/root?objectId=dSMwdKWSxI9fMt5HC9oxY9I4yeXSnyTEgLkUIrYIZzo&cmisSelector=acl&filter=cmis:name,cmis:objectId,cmis:path,cmis:baseTypeId,cmis:secondaryObjectTypeIds,cmis:objectTypeId,cmis:createdBy,cmis:creationDate,cmis:lastModifiedBy,cmis:lastModificationDate,cmis:contentStreamFileName,cmis:versionLabel,cmis:isVersionSeriesCheckedOut,cmis:versionSeriesCheckedOutBy,cmis:versionSeriesCheckedOutId,cmis:contentStreamMimeType,cmis:contentStreamLength,cmis:description,mcm:sharePassword,mcm:expirationDate,mcm:uploadAllowed,mcm:enableUpload,mcm:validToDate&maxItems=50000&skipCount=0&includeAllowableActions=true&renditionFilter=cmis:thumbnail,application/pdf,image/bmp,image/gif,image/jpeg,image/png&succinct=true"

看起来比较长,我们一步步解析:

  • b7579290-68c7-44b6-b135-2b5150e7c434为Repository的ID
  • objectId=dSMwdKWSxI9fMt5HC9oxY9I4yeXSnyTEgLkUIrYIZzo 为请求的Object的ID
  • cmisSelector=acl表示这个请求是请求这个Object的ACL
  • filter=......这一段表示返回值返回那些内容
  • maxItems=50000最大返回数量
  • includeAllowableActions=true表示返回值中携带这个文件有哪些可以操作的Action
  • renditionFilter=cmis:thumbnail,application/pdf,image/bmp,image/gif,image/jpeg,image/png表示这个文件类型
  • succinct=true返回值简单点

同理,所有的POST请求也是这样,只不过把请求放在了Body和Payload里面(关于Body和Payload这里有个博客)

SAP Document Center

SAP document center是使用CMIS协议来的,同时用了Apache Chemistry的库。这里是他的架构
SAP Document Center Architecture

这个服务所有关于Document的通信都是使用CMIS协议,而其他比如User管理是REST API。

由于CMIS Server和请求的Server不在一个Server,浏览器就会存在跨域的问题,这时候我们需要一个Token,而这个Token可以在JS代码这样写:

$.ajax({url: url,type: "GET",beforeSend: function(xhr) {xhr.setRequestHeader("X-CSRF-Token", "fetch");},success: function(result, xhr, data) {that.sDocToken = data.getResponseHeader("X-CSRF-Token");}
});

在本次请求CMIS Server带上这个Token就OK了。

ACL(Access Control List)

An Access Control List (ACL) is a list of Access Control Entries (ACEs) and MAY hold zeroor more ACEs. If an ACL has no ACEs, the behavior is the same as if the ACL is not set.
An ACE holds:
• A principal that represents a user management object, e.g. a user, group, or role. It holds one string with the principalId.
• One or more strings with the names of the permissions.
• A boolean flag direct which indicates if TRUE that the ACE is directly assigned to the object. If FALSE, that the ACE is somehow derived or inherited.

Versioning

CMIS Version Process

可以看到Version内部的过程就是这样,其实这是在Server段实现的过程,若是前段请求根本不要考虑的。


http://www.ppmy.cn/news/536896.html

相关文章

振芯GM8775C:MIPI TO LVDS

1 产品概述 GM8775C 型 DSI 转双通道 LVDS 发送器产品主要实现将 MIPI DSI 转单/双通道 LVDS 功能,MIPI 支持 1/2/3/4 通道可选,最大支持 4Gbps 速率。LVDS 时钟频率最高 154MHz, 最大支持视频格式为 FULL HD(1920 x 1200&#xf…

浅析AM335x GPMC模块地址区域的划分--TI--Sitara AM335x系列

我们知道AM335x的GPMC模块作为一组并行的外部总线接口,使用的频率还是挺高的,在这上面可以挂NAND FLASH,NOR FLASH,FPGA,DM9000等等设备。 使用的方式,从硬件方面来说,GPMC总线上挂的设…

MIPI名称和参数

MIPI CSI DSI MIPI CSI DSI名称和参数1.pin 信号2.输出:3.VGA4.全局曝光5.VSYNC 模式三种: SOF(start of frame)信号后设置VSYNC拉高;6.两个内置的PLL 用于产生系统时钟。7.行消隐(HBlank)8.一个CLOCK几个lane是可以同时传输数据的…

MIPI简介

文章目录 1.MIPI来源2.MIPI联盟的显示规范标准 2.1 DSI/CSI分层 3.MIPI D-PHY 3.1 D-PHY配置3.2 D-PHY的工作模式 4.D-PHY两种模式的实现示意图 4.1 HS模式4.2 LP模式 5.D-PHY三种工作模式的数据传递示意图 5.1 时钟连续模式5.2 时钟普通模式(非连续时钟模式&#x…

1197. CMI

Description 给出一个1到n的排列,每次可以移动一个数到任意一个位置(第一个数前,最后一个数后或者两个数之间的位置)。问要达到状态1; 2; 3⋯⋯n至少移动多少次? Input 第一行一个正整数N。 第二行N个整数&#xff…

cmu15445 2023spring project01

Project #0 - C Primer 资源 课程主页 Bustub Github 在线测试网站 (Entry Code: 2KJRB5), 注意用外国大学以及gmail注册。 lab0资源 我的lab0实现,入门实现有困难的同学可以参考一下。 Backgroud 环境 我的是Ubuntu 9.4.0 vscode 语法 需要了解…

CMIP6入门 CMIP数据信息

CMIP6入门 最近学习CMIP6,一些有关CMIP6的入门资料在此分享。 1.相关文献 《第六次国际耦合模式比较计划(CMIP6)评述》周天军 链接: http://www.climatechange.cn/CN/10.12006/j.issn.1673-1719.2019.193 这篇文章介绍了CMIP的发展历程&…

CMU-15-445 lecture01

Database:对现实世界一些事物建模的、具有内部联系的数据。 Database Management System(DBMS):管理数据库的软件,早期的DBMS逻辑层和物理层高度耦合。 Data Model:描述数据库中数据形式的模型 Relational Model:SQLKey/Value、Graph、Doc…