[Mulgara-dev] Using krule from the Java API

Agustina Martinez amgcia at gmail.com
Mon Jan 19 08:51:35 UTC 2009


Hi Paul,

Thanks for your complete and quick response :). On Friday, before reading
your mail, I found the "ApplyRules" and it works properly!
We are going to use Mulgara in the top of a Fedora repository and we are
evaluating different ways to connect our Web applications with Mulgara. I am
particularly interested in using the Web services front-end but I haven't
found much documentation.  Then my question is the followng, the possibility
I think is using the Mulgara War file, to deploy it in my own Tomcat install
but when I deploy the war file generated, there are no web services
available and the folder is almost empty, are there any additional steps
neccesary?

Thanks in advance,
Agustina

2009/1/17 Paul Gearon <gearon at ieee.org>

> On Thu, Jan 15, 2009 at 2:43 AM, Agustina Martinez <amgcia at gmail.com>
> wrote:
> > Hi all,
> >
> > I am newbie to Mulgara. I am trying to use the Java API to access Mulgara
> > from  a Web application. I stablish the connection and can make some
> queries
> > but when I use the Krule methods, e.g. KruleLoader.newInstance, it
> creates
> > the new instance correcly but when I try to invoque the readRules method
> I
> > get the exception:
>
> This API was designed for internal use only. I'd be surprised if you
> can make it work.
>
> If you want to run rules, you need to execute an ApplyRules operation
> on a Connection. See:
>  src/jar/query/java/org/mulgara/query/operation/ApplyRules.java
>
> > java.lang.ClassCastException: org.mulgara.connection.SessionConnection
> >     at org.mulgara.krule.KruleLoader.readRules(KruleLoader.java:224)
>
> Have you changed the KruleLoader class? Line 224 doesn't have anything on
> it.
>
> > I haven't found any documentation regarding using krule from Java
>
> That's because you're not supposed to.  :-)
>
> > and I
> > have doubts about the opContextParam parameter, at the moment I am
> passing
> > the connection session:
> >     myLoaderInstance.readRules(connection.getSession, this.ruleModel);
>
> No, you need an OperationContext. These come from
> DatabaseSession.newOperationContext(boolean write).  The "write"
> parameter indicates if the context is read only or read/write. If you
> "Session" is really a "DatabaseSession", then your original code might
> be fixed if you try:
>
>
> myLoaderInstance.readRules(((DatabaseSession)connection.getSession()).newOperationContext(false),
> this.ruleModel);
>
> (Not that I advocate doing this)
>
> Paul
> _______________________________________________
> Mulgara-dev mailing list
> Mulgara-dev at mulgara.org
> http://mulgara.org/mailman/listinfo/mulgara-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mulgara.org/pipermail/mulgara-dev/attachments/20090119/054de6a2/attachment.htm>


More information about the Mulgara-dev mailing list