读书人

Jackrabbit学习札记1

发布时间: 2012-09-16 17:33:17 作者: rapoo

Jackrabbit学习笔记1

? ? ? ? 最近软件测评中心有一个项目要做,Ext方面的人不够用,正好Ext我自学过一些,就去做了兼职,正好就聊起了他们那个项目,感觉还是蛮大的,主要是一个公司的内部系统,好像是什么平台管理的还有一个CRM还有其他的子系统,反正听他讲还是蛮复杂的,他们现在在做需求,正式编码要到12月份的样子,现在的时间我们正好去熟悉下jackrabbit。

? ? ? ? 以前从来没有接触过jackrabbit这个项目,今天搞了好久,看了很多学习jackrabbit的博客,但是进展很小,最后无奈又回到官网上了,慢慢发现其实官网上面的介绍还是蛮好的。就把这个学习笔记记录了下来,以后如果有可能看的话,就再来看。

? ? ? ? 好了废话少说,还是一步步讲步骤吧。首先需要下载jackrabbit相关的资源,去官网的话当然没有问题,可是实际操作的时候总是会发现有些文件下载失败,所以推荐去人人网下载:http://labs.renren.com/apache-mirror//jackrabbit/

? ? ? ? 在这个链接下面选择一个下载,新版本的话可能会好一些,所以我下载的是2.2.9(2.3.0现在还不稳定)。

? ? ? ? 下载完之后在MyEclipse下面新建一个Web项目,如下图所示:


Jackrabbit学习札记1

? ? ? ? 注意添加Maven的支持,并且这是官网推荐的,需要说明的是第一次加载该项目的时候可能会很慢,MyEclipse会去官网上面下载一些文件,这个我们不用去关心。

? ? ? ? 然后就将上面下载的一个jackrabbit-standalone-2.2.9.jar文件拷贝到lib下面,然后引入该包,就可以使用jackrabbit的东西了。

? ? ? ? 新建一个测试的类,如下图所示



Jackrabbit学习札记1

代码如下:

?

?运行该程序,可见到结果:

?

Logged in as anonymous to a Jackrabbit repository.

登录仓库身份:anonymous,登录名为:Jackrabbit

这就表明我们成功使用jackrabbit实现了第一个程序!

然后继续:新建第二个测试类SecondHop.java,代码如下:

?

?

同时新建一个test.xml文件:放在和src平行的目录下,内容如下:

?

?然后运行该程序,结果如下:

?

Importing xml... done.//jcr:primaryType = rep:root/jcr:system/importxml/importxml/jcr:primaryType = nt:unstructured/importxml/xhtml:html/importxml/xhtml:html/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:head/importxml/xhtml:html/xhtml:head/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:head/xhtml:title/importxml/xhtml:html/xhtml:head/xhtml:title/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:head/xhtml:title/jcr:xmltext/importxml/xhtml:html/xhtml:head/xhtml:title/jcr:xmltext/jcr:xmlcharacters = Three Namespaces/importxml/xhtml:html/xhtml:head/xhtml:title/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/importxml/xhtml:html/xhtml:body/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/xhtml:h1/importxml/xhtml:html/xhtml:body/xhtml:h1/align = center/importxml/xhtml:html/xhtml:body/xhtml:h1/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/xhtml:h1/jcr:xmltext/importxml/xhtml:html/xhtml:body/xhtml:h1/jcr:xmltext/jcr:xmlcharacters = An Ellipse and a Rectangle/importxml/xhtml:html/xhtml:body/xhtml:h1/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/svg:svg/importxml/xhtml:html/xhtml:body/svg:svg/width = 12cm/importxml/xhtml:html/xhtml:body/svg:svg/height = 10cm/importxml/xhtml:html/xhtml:body/svg:svg/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/svg:svg/svg:ellipse/importxml/xhtml:html/xhtml:body/svg:svg/svg:ellipse/ry = 130/importxml/xhtml:html/xhtml:body/svg:svg/svg:ellipse/rx = 110/importxml/xhtml:html/xhtml:body/svg:svg/svg:ellipse/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/svg:svg/svg:rect/importxml/xhtml:html/xhtml:body/svg:svg/svg:rect/x = 4cm/importxml/xhtml:html/xhtml:body/svg:svg/svg:rect/y = 1cm/importxml/xhtml:html/xhtml:body/svg:svg/svg:rect/width = 3cm/importxml/xhtml:html/xhtml:body/svg:svg/svg:rect/height = 6cm/importxml/xhtml:html/xhtml:body/svg:svg/svg:rect/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/xhtml:p/importxml/xhtml:html/xhtml:body/xhtml:p/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/xhtml:p/jcr:xmltext/importxml/xhtml:html/xhtml:body/xhtml:p/jcr:xmltext/jcr:xmlcharacters = The equation for ellipses/importxml/xhtml:html/xhtml:body/xhtml:p/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/importxml/xhtml:html/xhtml:body/mathml:math/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:eq/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:eq/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:cn/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:cn/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:cn/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:cn/jcr:xmltext/jcr:xmlcharacters =  1 /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:cn/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:plus/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:plus/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:divide/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:divide/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:power/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:power/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:ci/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:ci/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:ci/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:ci/jcr:xmltext/jcr:xmlcharacters =  x /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:ci/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:cn/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:cn/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:cn/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:cn/jcr:xmltext/jcr:xmlcharacters =  2 /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply/mathml:cn/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:power/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:power/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:ci/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:ci/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:ci/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:ci/jcr:xmltext/jcr:xmlcharacters =  a /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:ci/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:cn/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:cn/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:cn/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:cn/jcr:xmltext/jcr:xmlcharacters =  2 /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply/mathml:apply[2]/mathml:cn/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:divide/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:divide/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:power/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:power/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:ci/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:ci/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:ci/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:ci/jcr:xmltext/jcr:xmlcharacters =  y /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:ci/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:cn/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:cn/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:cn/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:cn/jcr:xmltext/jcr:xmlcharacters =  2 /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply/mathml:cn/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:power/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:power/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:ci/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:ci/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:ci/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:ci/jcr:xmltext/jcr:xmlcharacters =  b /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:ci/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:cn/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:cn/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:cn/jcr:xmltext/importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:cn/jcr:xmltext/jcr:xmlcharacters =  2 /importxml/xhtml:html/xhtml:body/mathml:math/mathml:apply/mathml:apply/mathml:apply[2]/mathml:apply[2]/mathml:cn/jcr:xmltext/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/xhtml:hr/importxml/xhtml:html/xhtml:body/xhtml:hr/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/xhtml:p[2]/importxml/xhtml:html/xhtml:body/xhtml:p[2]/jcr:primaryType = nt:unstructured/importxml/xhtml:html/xhtml:body/xhtml:p[2]/jcr:xmltext/importxml/xhtml:html/xhtml:body/xhtml:p[2]/jcr:xmltext/jcr:xmlcharacters = Last Modified January 10, 2002/importxml/xhtml:html/xhtml:body/xhtml:p[2]/jcr:xmltext/jcr:primaryType = nt:unstructured

?至此,jackrabbit的3个测试类已经完成,需要用到高级的东西时候就要参考其他的文件,这些内容以后学到了再写。


?

读书人网 >互联网

热点推荐