Hi Melanie,
It is true that a content repo is needed to run unit tests. Anyway, I
tested the Jackrabbit and I shall share the steps with you. I hope they
would work for you too.
First of all, I was able to create nodes in Jackrabbit through the JCR API.
- I ran the jackrabbit-standalone-2.4.2.jar on the 8080 port.
- Then created temporary nodes with the following code below. The code
create two nodes to be submitted to the Contenthub under the "test"
path. The nodes are associated with two files from the local file
system. So, you should adapt the file paths. 3 external libraries are
required to run this code: jackrabbit-jcr-rmi-2.2.*.jar, jcr-2.0.jar and
slf4j-api-*.jar. They are already downloaded when you build Stanbol into
the maven repository i.e the .m2 folder.
Repository repository = new URLRemoteRepository(
"http://localhost:8080/rmi");
Session session = repository.login(new SimpleCredentials("admin",
"admin".toCharArray()));
Node testNode = null;
try {
testNode = session.getNode("/test");
testNode.remove();
} catch (PathNotFoundException e) {
// ignore
}
Node rootNode = session.getRootNode();
testNode = rootNode.addNode("test");
File f = new File(
"/home/suat/Desktop/technicalStuff/stanbolTests/cmsAdapter/jackrabbit/news1.txt");
Node newsNode = testNode.addNode(f.getName(), "nt:file");
Node resourceNode = newsNode.addNode("jcr:content", "nt:resource");
resourceNode.setProperty("jcr:mimeType", "text/plain");
Binary binary = session.getValueFactory().createBinary(
new FileInputStream(f));
resourceNode.setProperty("jcr:data", binary);
f = new File(
"/home/suat/Desktop/technicalStuff/stanbolTests/cmsAdapter/jackrabbit/news2.txt");
newsNode = testNode.addNode(f.getName(), "nt:file");
resourceNode = newsNode.addNode("jcr:content", "nt:resource");
resourceNode.setProperty("jcr:mimeType", "text/plain");
binary = session.getValueFactory().createBinary(new
FileInputStream(f));
resourceNode.setProperty("jcr:data", binary);
session.save();
- I ran the Stanbol on 8081 and executed the following commands:
- curl -X GET -H "Accept: text/plain"
"http://localhost:8081/cmsadapter/session?repositoryURL=http://localhost:8080/rmi&username=admin&password=admin&connectionType=JCR"
- curl -i -X POST --data
"sessionKey=e92be985-e722-419f-a1ad-5fe02628b537&path=/test&recursive=true"
http://localhost:8081/cmsadapter/contenthubfeed
In the second command the result of the first command should be used.
After executing these commands, I was able to see documents on
http://localhost:8081/contenthub/contenthub/store.
Best,
Suat
On 08/20/2012 01:11 PM, Melanie Reiplinger wrote:
> Hi Suat,
>
> Thanks for your reply.
>
>
> Am 20.08.2012 11:55, schrieb Suat Gönül:
>> Hi Melanie,
>>
>> Sorry, I could not answer you as I was in holiday. I will start to
>> work on
>> August 27. In my demonstration, I was using CRX CMS.
>
>
> That seems to be commercial software. I Cannot use that. So I'll have
> to find another way. Under these conditions, I'm not even sure it
> makes much sense to create unit tests for the JavaScript interface to
> the cmsadapter, since whoever wanted to run them would need to have a
> content repo locally installed to connect stanbol to it. It makes
> sense only if I could set up (or use) a remote repo that's accessible
> from wherever the test script is called...
>
> Best,
> Melanie
>
>> But to connect CRX, I
>> have and additional bundle to be added to the OSGi environment. I can
>> provide you that bundle when I'm back.
>>
>> I did not access to the repo via HTTP. In my demonstration, a session is
>> obtained together with a session key after giving the necessary
>> credentials
>> e.g username, password, rmi endpoint. And that session key is used by
>> CMS
>> Adapter to access to the repo.
>>
>> Best,
>> Suat
>>
>> On Mon, Aug 20, 2012 at 12:11 PM, Melanie Reiplinger <
>> [email protected]> wrote:
>>
>>> Hi Suat,
>>>
>>> I cannot access my jackrabbit repo via xmlhttp either (although curl
>>> works
>>> fine), so this might as well be a CORS access problem. In your demo,
>>> did
>>> you have to somehow provide access to the repo (by setting headers
>>> etc)?
>>>
>>> Best,
>>> Melanie
>>>
>>> Am 15.08.2012 11:15, schrieb Melanie Reiplinger:
>>>
>>> Hi Suat,
>>>> Am 13.08.2012 13:35, schrieb Suat Gonul:
>>>>
>>>>> In any case, I guess that you
>>>>> need to configure a RDF Bridge through the
>>>>> {stanbol}/system/console/**configMgr interface. There you should find
>>>>> the
>>>>> "Apache Stanbol CMS Adapter Default RDF Bridge Configurations". In
>>>>> that
>>>>> configuration you specify the root path in the CMS to be exported
>>>>> to the
>>>>> RDF.
>>>>>
>>>>>> by that you mean the content repository path? This means that I set
>>>>>> there the path to my content repository?
>>>>>>
>>>>> Yes, you set there a path residing in the content repository.
>>>>>
>>>>> I have set up a jackrabbit workspace with some toy nodes in it. To
>>>>>> access it remotely, I'd configure something like
>>>>>> http://[myserver]/server/
>>>>>> <http://lnv-89012.dfki.uni-sb.**de:9002/server/default/node1<http://lnv-89012.dfki.uni-sb.de:9002/server/default/node1>>,
>>>>>>
>>>>>> but then
>>>>>> I can work with this repository exclusively, right?
>>>>>>
>>>>> I cannot access the URL you gave, but I guess you should give
>>>>> /node1
>>>>> path to export it as RDF. I didn't get your question about working
>>>>> exclusively with the repository. But, you already seem to work on the
>>>>> default repository of Jackrabbit running on your server.
>>>>>
>>>>>
>>>> I tried with several paths, none will work.
>>>> My remote repository stub is
>>>> http://lnv-89012.dfki.uni-sb.**de:9002/rmi<http://lnv-89012.dfki.uni-sb.de:9002/rmi>
>>>> .
>>>> (you cannot access those URIs because they are in a closed network)
>>>> For accessing the content repository, I should use (according to my
>>>> jackrabbit guidelines):
>>>> http://lnv-89012.dfki.uni-sb.**de:9002/server<http://lnv-89012.dfki.uni-sb.de:9002/server>to
>>>> access all workspaces of myJCR repository
>>>> http://lnv-89012.dfki.uni-sb.**de:9002/server/default/jcr:**rootto<http://lnv-89012.dfki.uni-sb.de:9002/server/default/jcr:rootto>access
>>>> a single workspace (example with workspace named 'default'). -> this
>>>> one is also where I can navigate to with my browser, so this should
>>>> then be
>>>> the correct path I guess.
>>>>
>>>>
>>>> But I always get the same error about
>>>> org.apache.stanbol.cmsadapter.**jcr.mapping.JCRRDFMapper Failed to
>>>> retrieve node having path: <thePath> or its childr
>>>>
>>>> I'm an absolute beginner with content repositories, using
>>>> jackrabbit for
>>>> the first time and I'm really unsure of what would have to work if
>>>> everything was correct, but I can see my repository in the jackrabbit
>>>> console and I also can see that my nodes are existing, and the info
>>>> command
>>>> tells me that everything looks like I would expect:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Repository:
>>>> http://lnv-89012.dfki.uni-sb.**de:9002/rmi<http://lnv-89012.dfki.uni-sb.de:9002/rmi>
>>>> User : admin
>>>> Workspace : default
>>>> Node : /
>>>>
>>>> I looked at your paper ("Semantic Content Management with Apache
>>>> Stanbol") and saw that you used jackrabbit in the demo, too. Is
>>>> there some
>>>> publicly accessible repository I could use for testing (so that I
>>>> see what
>>>> the path I have to specify looks like in a working example)?
>>>>
>>>> best,
>>>> melanie
>>>>
>>>>
>
>