> Without knowing your exact setup I cannot say if this is a good thing or
> not, but generally speaking it is not a good thing to get your packages from
> the class path...

I have the org.apache.felix.bundlerepository-1.0.3.jar file in my classpath,
and if I don't, it won't compile.

> Well, I'd still make sure that you have things set up correctly. If you
> have the OBR bundle installed and active, then you do not need to make the
> OBR API package available on the class path, because the OBR bundle does
> export this package; thus, your client bundle should import it...in fact
> your client bundle should be importing the package no matter what, since
> bundles should import everything not in java.*...
>
> So, it still sounds like something is odd.
>

If I don't put the org.apache.felix.bundlerepository-1.0.3.jar file on the
classpath, how will my code compile? If I use the Repository class without
adding the org.apache.felix.bundlerepository-1.0.3.jar file to my classpath,
it won't compile. Upon comping, it will say "cannot find symbol
'Repository'" or something of the sort.

Maybe I'm missing something though.

Thanks!

2008/5/17 Richard S. Hall <[EMAIL PROTECTED]>:

> Mathieu Plourde wrote:
>
>> Everything solved!
>>
>>
>
> Good, however...
>
> - My client bundle was not supposed to import
>> org.apache.felix.bundlerepository,
>> even though I needed the jar in the classpath. That solved the
>> inconsistency
>> problems.
>>
>>
>
> Without knowing your exact setup I cannot say if this is a good thing or
> not, but generally speaking it is not a good thing to get your packages from
> the class path...
>
> - I had to get the RepositoryAdmin service like it's shown in the tutorials
>> (using RepositoryAdmin.class.getName()). I had no more problems using this
>> because my inconsistency problems were solved.
>>
>>
>
> Well, I'd still make sure that you have things set up correctly. If you
> have the OBR bundle installed and active, then you do not need to make the
> OBR API package available on the class path, because the OBR bundle does
> export this package; thus, your client bundle should import it...in fact
> your client bundle should be importing the package no matter what, since
> bundles should import everything not in java.*...
>
> So, it still sounds like something is odd.
>
> -> richard
>
>
> Thank you!
>>
>>
>> 2008/5/16 Richard S. Hall <[EMAIL PROTECTED]>:
>>
>>
>>
>>> Mathieu Plourde wrote:
>>>
>>>
>>>
>>>> Hello all,
>>>>
>>>>  I'm a newbie using Felix and I'm wondering how to use the OBR (
>>>>
>>>> http://felix.apache.org/site/apache-felix-osgi-bundle-repository-obr.html
>>>> ).
>>>> In the application I'm working on, I want to be able to add my own
>>>> repositories. So far I've registered the Apache Felix Bundle Repository
>>>> as
>>>> a
>>>> bundle, but I don't know how to use it. The following code (from the
>>>> Felix
>>>> OBR site) does exactly what I want:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> RepositoryAdmin repoAdmin = ... // Get repo admin service
>>>>> Resolver resolver = repoAdmin.resolver();
>>>>> Resource resource = repoAdmin.discoverResources(filterStr);
>>>>> resolver.add(resource);
>>>>> if (resolver.resolve())
>>>>> {
>>>>>   resolver.deploy(true);
>>>>> }
>>>>> else
>>>>> {
>>>>>   Requirement[] reqs = resolver.getUnsatisfiedRequirements();
>>>>>   for (int i = 0; i < reqs.length; i++)
>>>>>   {
>>>>>       System.out.println("Unable to resolve: " + reqs[i]);
>>>>>   }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> The only problem is how to get the repo admin service?
>>>>
>>>>
>>>>
>>> You need to lookup the service in the OSGi service registry.
>>>
>>> The only coding stuff
>>>
>>>
>>>> I've done with Felix are the tutorials. I read a lot of doc, but I'm
>>>> struggling with the coding.
>>>>
>>>>
>>>>
>>> Well, if you have done the tutorials, you should look more closely at how
>>> the clients lookup services in the service registry (see examples 3 &
>>> 4)...the OBR bundle provides the RepositoryAdmin service. Your client
>>> bundle
>>> will need to do a service lookup to find it. Once you have the service,
>>> then
>>> you will be able to do the above code.
>>>
>>> The only thing I've done so far
>>>
>>>
>>>> is installing/activating the Apache Felix Bundle Repository bundle.
>>>> That's
>>>> pretty much it. I want to use the repo admin service in another bundle.
>>>> Do
>>>> I
>>>> need to import the packages in that bundle? When I do it, I get
>>>> conflicts
>>>> saying some classes are loaded twice. For example, if I use the class
>>>> Repository, it says the classloader already loaded the same class
>>>> already (The Apache Felix Bundle Repository is installed as a bundle,
>>>> and
>>>> I
>>>> also inculded the .jar file in the classpath. Maybe that could be the
>>>> problem? But if I don't add it to the classpath, how to I access the
>>>> classes?)
>>>>
>>>>
>>>>
>>>>
>>> In order to use the OBR service you will need to import the OBR API
>>> package
>>> in your client bundle. If you are getting inconsistency, it is likely
>>> because you have the classes available from more than one place (e.g., on
>>> your class path or in your client bundle). Generally speaking, the OBR
>>> packages should only be contained in the OBR bundle JAR file and no place
>>> else.
>>>
>>> As you can see I got some basic problems with it. I would really
>>> appreciate
>>>
>>>
>>>> if you could help me. Also if you have some interesting sites/doc about
>>>> Felix OBR, send them out please.
>>>>
>>>>
>>>>
>>>>
>>> I know you were using SIP Communicator, but for these experiments, I
>>> would
>>> just work with Felix by itself for now. When you start Felix in already
>>> has
>>> OBR installed, so you just need to create a simple client bundle that
>>> will
>>> import the OBR API package in its manifest and do the service lookup in
>>> its
>>> start() method. It should be pretty simple for you to get this working;
>>> however, if you are still having difficulties at this point, then you can
>>> easily post your bundle code and manifest and we will be able to figure
>>> it
>>> out quickly.
>>>
>>> -> richard
>>>
>>> Thank you very much!
>>>
>>>
>>>> Sincerely,
>>>>   Mathieu
>>>>
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to