[rules-users] Help : How do I retrieve the repository or uuid of assets from java code?

Han Ming Low hanming73 at gmail.com
Thu Sep 2 02:30:20 EDT 2010


Hi,

I'm trying to construct a url in the format
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/Guvnor.html#asset=4dae7ddf-4d97-4e6b-ab07-b0f5e9d41d9c
by replacing the #asset=[uuid]

Thus, I would need to know the uuid of each asset in the repository.

I have tried to use the following code

        Repository repository;
        JCRRepositoryConfigurator configurator = new
JackrabbitRepositoryConfigurator();
        repository = configurator.getJCRRepository(
"C:\\Programs\\Drools\\5.1\\jboss-4.2.3.GA\\repository\\" );
        Session jcrsession = repository.login(new SimpleCredentials("admin",
"admin1".toCharArray()));
        RulesRepository rrepository = new RulesRepository(jcrsession);
or

        RulesRepository rrepository = RepositorySessionUtil.getRepository();

My drools persistence is set to MySQL.
So, RepositorySessionUtil.getRepository() kind of work but because it is
retrieving from a new repository, so it does not serve the purpose.

When I put the code above into a jsp in exploded drools-guvnor.war in jboss,
I have the following error.

org.drools.repository.RulesRepositoryException:
javax.jcr.RepositoryException: The repository home C:\Programs\Drools\5.1\
jboss-4.2.3.GA\bin\repository appears to be in use since the file named
.lock is already locked by the current process.
 org.drools.repository.RepositorySessionUtil.getRepository(RepositorySessionUtil.java:90)
 org.apache.jsp.test_jsp._jspService(test_jsp.java:105)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
 org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
 org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

But, I'm not even sure if what I'm trying to do is correct.
What I want to do is to be able to retrieve the uuid of the assets in
repository from a web application.
Can someone please help in providing a snippet of code or point me in some
direction on what should I retrieve in order to query the repository.

Thanks.


Han Ming
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100902/340b186f/attachment.html 


More information about the rules-users mailing list