jcr

Get File Out of JCR File Node

爷,独闯天下 提交于 2019-11-30 02:36:32
I have the following code to insert "rose.gif" into a roseNode. But how do I retrieve the file from the repository? Node roseNode = session.getRootNode().getNode("wiki:encyclopedia/wiki:entry[1]/"); File file = new File("rose.gif"); MimeTable mt = MimeTable.getDefaultTable(); String mimeType = mt.getContentTypeFor(file.getName()); if (mimeType == null) mimeType = "application/octet-stream"; Node fileNode = roseNode.addNode(file.getName(), "nt:file"); System.out.println( fileNode.getName() ); Node resNode = fileNode.addNode("jcr:content", "nt:resource"); resNode.setProperty("jcr:mimeType",

How to set a resource property

夙愿已清 提交于 2019-11-30 01:51:52
问题 I have a Sling Resource object. What is the best way to set or update its property? 回答1: It depends on the Sling version: Sling >= 2.3.0 (since CQ 5.6) Adapt your resource to ModifiableValueMap, use its put method and commit the resource resolver: ModifiableValueMap map = resource.adaptTo(ModifiableValueMap.class); map.put("property", "value"); resource.getResourceResolver().commit(); Sling < 2.3.0 (CQ 5.5 and earlier) Adapt your resource to PersistableValueMap, use its put and save methods:

JCR SQL2 - result query order as in JCR browser

蹲街弑〆低调 提交于 2019-11-29 11:37:33
I use an application where we can manipulate JCR nodes, typically you would rename, remove, delete, or else move them. Using the JCR API, I can access the nodes in my repository and return a set of nodes in the same order as they are in the JCR. I would like to be able to do the same using the JCR SQL2 queries. I have not found anything about this & now start to believe this is not possible. For instance, if I have a JCR tree such as: parentNode |_childNode1 |_childNode2 |_childNode3 |_childNode4 When querying using the JCR SQL2 it would return them in an order different from: childNode1,

Apache Jackrabbit JCA 2.7.5 .docx and .xlsx indexing

烂漫一生 提交于 2019-11-29 05:31:12
I'm ussing the Appache Jackrabbit JCA 2.7.5, the problem is that files .docx and .xlsx is not indexed. My steps : Deploy the Jackrabbit JCA as resource adapter on glassfish create a Connector Connection Pool for the resource adapter indicating the ConfigFile=path/to/the/repository.xml and HomeDir=path/to/the //miss the repository.xml create a Connector Resources for the connector pool (the jndi) create web application create class to get session from the connector ressources (code below) import java.io.Serializable; import java.net.MalformedURLException; import javax.annotation.Resource;

Get File Out of JCR File Node

落爺英雄遲暮 提交于 2019-11-28 23:38:29
问题 I have the following code to insert "rose.gif" into a roseNode. But how do I retrieve the file from the repository? Node roseNode = session.getRootNode().getNode("wiki:encyclopedia/wiki:entry[1]/"); File file = new File("rose.gif"); MimeTable mt = MimeTable.getDefaultTable(); String mimeType = mt.getContentTypeFor(file.getName()); if (mimeType == null) mimeType = "application/octet-stream"; Node fileNode = roseNode.addNode(file.getName(), "nt:file"); System.out.println( fileNode.getName() );

JCR SQL2 - result query order as in JCR browser

谁都会走 提交于 2019-11-28 04:56:10
问题 I use an application where we can manipulate JCR nodes, typically you would rename, remove, delete, or else move them. Using the JCR API, I can access the nodes in my repository and return a set of nodes in the same order as they are in the JCR. I would like to be able to do the same using the JCR SQL2 queries. I have not found anything about this & now start to believe this is not possible. For instance, if I have a JCR tree such as: parentNode |_childNode1 |_childNode2 |_childNode3 |

Apache Jackrabbit JCA 2.7.5 .docx and .xlsx indexing

无人久伴 提交于 2019-11-27 23:04:36
问题 I'm ussing the Appache Jackrabbit JCA 2.7.5, the problem is that files .docx and .xlsx is not indexed. My steps : Deploy the Jackrabbit JCA as resource adapter on glassfish create a Connector Connection Pool for the resource adapter indicating the ConfigFile=path/to/the/repository.xml and HomeDir=path/to/the //miss the repository.xml create a Connector Resources for the connector pool (the jndi) create web application create class to get session from the connector ressources (code below)

When to use JCR (content repository) over other options?

﹥>﹥吖頭↗ 提交于 2019-11-27 06:02:08
I'm trying to evaluate content repositories ( JSR283 ) like Jackrabbit and ModeShape but I must confess that I don't understand what problem resolves in first place and even if it is a good choice for the project. Which cases do you think is the best solution to apply? Is not the same thing as relational databases, except for the size? Why? Extra points for pointing real world examples. Thanks in advance. JCR repositories are different than RDBMSes, because a JCR repository: is hierarchical, allowing your to organize your content in a structure that closely matches your needs and where related

When to use JCR (content repository) over other options?

瘦欲@ 提交于 2019-11-26 12:51:18
问题 I\'m trying to evaluate content repositories (JSR283) like Jackrabbit and ModeShape but I must confess that I don\'t understand what problem resolves in first place and even if it is a good choice for the project. Which cases do you think is the best solution to apply? Is not the same thing as relational databases, except for the size? Why? Extra points for pointing real world examples. Thanks in advance. 回答1: JCR repositories are different than RDBMSes, because a JCR repository: is