On Wed, Jan 5, 2011 at 9:13 PM, Alessandro Adamou <
[email protected]> wrote:

>  Thank you Reto!
>
> Unfortunately I've had no luck having Declarative Services work in Equinox
> so far. Thought it was the org.eclipse.equinox.ds bundle but it didn't work
> for me.
>
I have a wage remembrance of the felix and the equinox implementation having
a bit a different reading of the specification of the service-xml files (one
needed namespaces and the other not) if you find out more it would be great
to know how to have the clerezza-bundles working with both-impls.
Alternatively I think the felix-scr bundles work also on equinox.


>
> I guess I'll try specializing the TcManager then.
>
> I used to bind a TcProvider like this: TcManager.addWeightedTcProvider(new
> SimpleTcProvider()) , but as you hinted perhaps this is not the right
> approach?
>
addWeightedTcProvider is the inherited public version of
bindWeightedTcProvider


> Are there any other protected bind methods that I should call and don't
> appear in the sources?
>
The bind-method are generated for @Reference annotation on the fields, the
only one I see here is for the queryEngine.

>
> Thanks again. I have forwarded this suggestion to my mates.
>
> All the best,
>
To you too!

Reto

>
> Alessandro
>
>
>
> On 1/5/11 8:52 PM, Reto Bachmann-Gmuer wrote:
>
> Hi Alessandro
>
>  I am sorry for addressing you so directly, but I'm not sure where it is
>> more appropriate to post such questions (couldn't find a mailing list for
>> users on the Clerezza homepage) and unfortunately my issue is very urgent.
>>
>
> There's only one mailing list, both for users and devleopers, its
> [email protected] (added in cc)
>
>>
>> I am running an Equinox environment (plain, no SCR/Declarative services),
>> which includes some Clerezza bundles (mainly the org.apache.clerezza.rdf.*
>> ones).
>>
>> At some point I need to run a SPARQL query via
>> TcManager.executeSparqlQuery(), having obtained TcManager via
>> TcManager.getInstance() . This throws a NoQueryEngineException.
>>
>> However the org.apache.clerezza.rdf.jena.sparql bundle and its
>> dependencies are active and started before the bundle that does the query.
>>
>> Since org.apache.clerezza.rdf.jena.sparql contains a QueryEngine service
>> specification in its META-INF/services , shouldn't the Jena query engine be
>> registered automatically?
>
> META-INF services is used only outside an OSGi environment.
>
>
>> Or this doesn't hold in OSGi? Is there a way to register it myself
>> programmatically?
>>
>
> The problem is that the bindQueryEngine-method is protected so it cannot be
> called unless you subclass TcManager or if you use declarative service (or
> do the same magic otherwise).
>
> What I'm wondering is how the TcProviders are registered? The getInstance
> static method is designed for non-osgi use and locates the TcProvider (such
> as the one provided by the org.apache.clerezza.rdf.jena.tdb.storage) using
> META-INF/services.
>
> I think you should use declarative service, if not I think the easiest is
> subclass TcManager and inject the weightedTcProvider and queryEngine using
> the bind-methods (which you don't see when looking at the TcManager source,
> nevertheless they are in the compiled class file because they are added by
> the maven-scr-plugin).
>
> Cheers,
> Reto
>
>
>> Thank You,
>> Alessandro
>>
>> --
>> Alessandro Adamou
>> Semantic Technology Laboratory (STLab)
>> Institute for Cognitive Science and Technology (ISTC)
>> National Research Council (CNR)
>> Via Nomentana 56, Rome - Italy
>>
>>
>
>
> --
> Alessandro Adamou
> Semantic Technology Laboratory (STLab)
> Institute for Cognitive Science and Technology (ISTC)
> National Research Council (CNR)
> Via Nomentana 56, Rome - Italy
>
>

Reply via email to