Jackrabbit/JCR 文本内容数据的组织
我正在考虑如何在 Jackrabbit 中组织“正常”文本内容(即字符串、HTML 代码...)。 是否有任何推荐的纯文本内容结构(例如文件)?
我应该将每个文本内容存储为二进制文件(就像我对文件所做的那样) 节点(nt:文件夹)-->节点(nt:文件) --> Node(jcr:content 带有保存二进制文件的 jcr:data 属性)
或者最好有类似的东西 节点(nt:文件夹)--> Node(nt:非结构化,带有保存字符串的 jcr:message 属性)
我的第三个想法是为文本内容创建一个单独的名称空间 节点(nt:文件夹)--> Node(my:text 带有保存字符串的 jcr:message 属性) 节点(nt:文件夹)--> Node(my:html 带有保存字符串的 jcr:message 属性) ...
你认为最好的解决方案是什么? 很高兴能讨论这个问题。
i was thinking about, how to organize "normal" text content (i.e a String, HTML Code ...) in Jackrabbit.
Are there any recommended structures for plain text content (like for files)?
Should i store each text content as a binary (like i do with files)
Node(nt:folder)--> Node(nt:file) --> Node(jcr:content with a jcr:data property which holds the binary)
Or is it better to have something like
Node(nt:folder)--> Node(nt:unstructured with a jcr:message property which holds the string)
My third idea was to create a separate name space for text content
Node(nt:folder)--> Node(my:text with a jcr:message property which holds the string)
Node(nt:folder)--> Node(my:html with a jcr:message property which holds the string)
...
What do you thing is the best solution?
It would be great to discuss this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将文本和 html 内容存储为 nt:file 结构使其可以通过 WebDAV 和其他理解这些结构的工具可见。根据您的应用程序,这可能很有用。
如果您不需要这个,您可以将文本内容存储为属性。在这种情况下,使用 JSR-283 规范的“标准应用程序节点类型”部分中定义的标准属性名称:jcr:title、jcr:description 等有助于使事情保持一致。
另请参阅 http://wiki.apache.org/jackrabbit/DavidsModel 其中有一些相关建议。
Storing text and html content as nt:file structures makes it visible via WebDAV and other tools that understand those structures. That can be useful depending on your application.
If you don't need this, you can just store your textual content as properties. In this case, using standard property names: jcr:title, jcr:description etc. as defined in the Standard Application Node Types section of the JSR-283 spec helps make things consistent.
See also http://wiki.apache.org/jackrabbit/DavidsModel which has some related recommendations.
我会将常规文本存储在字符串属性中,除非它是大型(数千字节)文本。这类似于关系数据库中的VARCHAR。
对于不是“文件”的非常大的文本,我将使用二进制属性(流)。此类属性存储在 DataStore 中,其写入和访问速度比字符串属性慢,但是不会将整个项目加载到内存中,并且只会将相同的数据存储一次。这类似于关系数据库中的BLOB/CLOB。
对于文件,我将使用
nt:folder
/nt:file
。这类似于文件系统中的文件。I would store regular text in a string property, unless it's a large (multi-kilobyte) text. This is similar to VARCHAR in a relational database.
For really large texts that are not 'files', I would use a binary property (a stream). Such properties are stored in the DataStore, which is slower to write and access than a string property, but will not load the whole item in memory, and will only store the same data once. This is similar to BLOB / CLOB in a relational database.
For files, I would use
nt:folder
/nt:file
. This is similar to a file in a file system.