Store metadata into Jackrabbit repository

后端 未结 3 673
情话喂你
情话喂你 2021-01-31 23:39

can anybody explain to me, how to proceed in following scenario ?

  1. receiving documents (MS docs, ODS, PDF)

  2. Dublic core metadata extraction via Ap

3条回答
  •  广开言路
    2021-02-01 00:08

    I am a bit rusty with JCR and I have never used 2.0 but this should get you started.

    See this link. You'll want to open up the second comment.

    You just store the file in a node and add additional metadata to the node. Here is how to store the file:

    Node folder = session.getRootNode().getNode("path/to/file/uploads"); 
    Node file = folder.addNode(fileName, "nt:file"); 
    Node fileContent = file.addNode("jcr:content"); 
    fileContent.setProperty("jcr:data", fileStream);
    // Add other metadata
    session.save();
    

    How you store meta-data is up to you. A simple way is to just store key value pairs:

    fileContent.setProperty(key, value, PropertyType.STRING);
    

    To read the data you just call getProperty().

    fileStream = fileContent.getProperty("jcr:data");
    value = fileContent.getProperty(key);
    

提交回复
热议问题