You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Daniel Veljjanoski <da...@gmail.com> on 2008/06/11 13:09:56 UTC

Start / Install - Felix Bundle

Hi,


 Is it possible to have a package (Folder) as a bundle ( NOT jar file)?

Something like the line below ( in the felix config file ) :


 felix.auto.start.1=
reference:file:net/java/sip/communicator/util/<file:///mybundle/util.jar>


 instead of :


 felix.auto.start.1=
reference:file:sc-bundles/util.jar<file:///mybundle/util.jar>


 Using the second line everything work fine for me, BUT, I want to work on
the SIP Communicator using eclipse.

My idea is to make development faster.


 -- Way?

Until now I proceed like on description below :



   1.

   Coding..
   2.

   Using "Make" from Eclipse->ANT->build.xml
   3.

   Using "Run" from Eclipse to run the project ( Or "Run" from Eclipse ->ANT
   )

I want to eliminate the point 2. because "Make" spend a lot of time during :

   1.

   Compilation of the code
   2.

   Make a Packages ( jar files - plugins)


 --How to?

I think that is possible because using eclipse doesn't need to recompile the
code, and we don't need to make a changes in the build.xml for do that - if
Felix can start/install a bundle from folder (eclipse package).


 The goal is to have a simple eclipse project :

   -

   Coding...
   -

   Using "Run" from Eclipse to run the project.


 Any suggestions please...?


 Excuse for my English.


 Cheers


-- 
Daniel VELJJANOSKI

Re: Start / Install - Felix Bundle

Posted by "Richard S. Hall" <he...@ungoverned.org>.
I'm with Stuart. Your change doesn't sound good.

-> richard

Stuart McCulloch wrote:
> 2008/6/12 Daniel Veljjanoski <da...@gmail.com>:
>
>   
>> Hi Richard,
>>
>>  Thanks a lot for your answer, it work fine for me but there is two
>> conditions :
>>
>>  reference:file:/path/to/exploded/jar
>>
>>    1.
>>
>>   The folder named  "jar" in the examle above MUST contains
>>   META-INF/MANIFEST.MF
>>     
>
>
> That is correct - otherwise it isn't a valid exploded bundle,
> just as a bundle jar should have META-INF/MANIFEST.MF
> (ie. when you unpack a bundle you will always see this file)
>
>   2.
>   
>>   I have changed the Felix.java :
>>
>>  *private* BundleActivator createBundleActivator(BundleInfo info){
>>
>> ...
>>
>> // Class clazz = info.getCurrentModule().getClass(className);
>>
>> // Adding a line below just after the line above.
>>
>> *if*(clazz == *null*) clazz= Class.*forName*(className);
>> ...
>>
>>     
>
> ouch - Class.forName should really be avoided where possible:
>
>
> http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html
>
> is there any particular reason why you needed to make this change?
>
> if you are getting a ClassNotFoundException it may be because your
> bundle is missing a package import - in which case the framework is
> working as designed and your bundle will also throw a CNFE on other
> frameworks.
>
> adding the appropriate import to your bundle should fix the problem
> without any framework change (FYI, if you use either the Bnd tool or
> the maven-bundle-plugin to create your bundle, then the appropriate
> imports will be added to your bundle manifest automatically)
>
> using Class.forName from the system bundle means you're implicitly
> adding all classes visible on the application classpath to any bundle,
> which is wrong - in OSGi the bootdelegation property is used to filter
> what packages are visible to the bundle via delegation:
>
> http://www.osgi.org/blog/2006/04/strong-lesson-about-modularity.html
>
> so an alternative solution to adding the missing import would be to
> set the "org.osgi.framework.bootdelegation" framework property
> to include the package(s) you want to make visible via delegation.
>
> HTH
>
> Cheers
>   
>> On Thu, Jun 12, 2008 at 11:19 AM, Richard S. Hall <he...@ungoverned.org>
>> wrote:
>>
>>     
>>> You can install a reference to an exploded bundle JAR directory using
>>>       
>> that
>>     
>>> syntax:
>>>
>>>   reference:file:/path/to/exploded/jar
>>>
>>> -> richard
>>>
>>> Daniel Veljjanoski wrote:
>>>
>>>       
>>>> Hi,
>>>>
>>>>
>>>>  Is it possible to have a package (Folder) as a bundle ( NOT jar file)?
>>>>
>>>> Something like the line below ( in the felix config file ) :
>>>>
>>>>
>>>>  felix.auto.start.1=
>>>>
>>>>         
>> reference:file:net/java/sip/communicator/util/<file:///mybundle/util.jar>
>>     
>>>>  instead of :
>>>>
>>>>
>>>>  felix.auto.start.1=
>>>> reference:file:sc-bundles/util.jar<file:///mybundle/util.jar>
>>>>
>>>>
>>>>  Using the second line everything work fine for me, BUT, I want to work
>>>>         
>> on
>>     
>>>> the SIP Communicator using eclipse.
>>>>
>>>> My idea is to make development faster.
>>>>
>>>>
>>>>  -- Way?
>>>>
>>>> Until now I proceed like on description below :
>>>>
>>>>
>>>>
>>>>   1.
>>>>
>>>>   Coding..
>>>>   2.
>>>>
>>>>   Using "Make" from Eclipse->ANT->build.xml
>>>>   3.
>>>>
>>>>   Using "Run" from Eclipse to run the project ( Or "Run" from Eclipse
>>>> ->ANT
>>>>   )
>>>>
>>>> I want to eliminate the point 2. because "Make" spend a lot of time
>>>>         
>> during
>>     
>>>> :
>>>>
>>>>   1.
>>>>
>>>>   Compilation of the code
>>>>   2.
>>>>
>>>>   Make a Packages ( jar files - plugins)
>>>>
>>>>
>>>>  --How to?
>>>>
>>>> I think that is possible because using eclipse doesn't need to recompile
>>>> the
>>>> code, and we don't need to make a changes in the build.xml for do that -
>>>> if
>>>> Felix can start/install a bundle from folder (eclipse package).
>>>>
>>>>
>>>>  The goal is to have a simple eclipse project :
>>>>
>>>>   -
>>>>
>>>>   Coding...
>>>>   -
>>>>
>>>>   Using "Run" from Eclipse to run the project.
>>>>
>>>>
>>>>  Any suggestions please...?
>>>>
>>>>
>>>>  Excuse for my English.
>>>>
>>>>
>>>>  Cheers
>>>>
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>       
>> --
>> Daniel VELJJANOSKI
>>
>>     
>
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Start / Install - Felix Bundle

Posted by Stuart McCulloch <st...@jayway.net>.
2008/6/12 Daniel Veljjanoski <da...@gmail.com>:

> Hi Richard,
>
>  Thanks a lot for your answer, it work fine for me but there is two
> conditions :
>
>  reference:file:/path/to/exploded/jar
>
>    1.
>
>   The folder named  "jar" in the examle above MUST contains
>   META-INF/MANIFEST.MF


That is correct - otherwise it isn't a valid exploded bundle,
just as a bundle jar should have META-INF/MANIFEST.MF
(ie. when you unpack a bundle you will always see this file)

  2.
>
>   I have changed the Felix.java :
>
>  *private* BundleActivator createBundleActivator(BundleInfo info){
>
> ...
>
> // Class clazz = info.getCurrentModule().getClass(className);
>
> // Adding a line below just after the line above.
>
> *if*(clazz == *null*) clazz= Class.*forName*(className);
> ...
>

ouch - Class.forName should really be avoided where possible:


http://blog.bjhargrave.com/2007/09/classforname-caches-defined-class-in.html

is there any particular reason why you needed to make this change?

if you are getting a ClassNotFoundException it may be because your
bundle is missing a package import - in which case the framework is
working as designed and your bundle will also throw a CNFE on other
frameworks.

adding the appropriate import to your bundle should fix the problem
without any framework change (FYI, if you use either the Bnd tool or
the maven-bundle-plugin to create your bundle, then the appropriate
imports will be added to your bundle manifest automatically)

using Class.forName from the system bundle means you're implicitly
adding all classes visible on the application classpath to any bundle,
which is wrong - in OSGi the bootdelegation property is used to filter
what packages are visible to the bundle via delegation:

http://www.osgi.org/blog/2006/04/strong-lesson-about-modularity.html

so an alternative solution to adding the missing import would be to
set the "org.osgi.framework.bootdelegation" framework property
to include the package(s) you want to make visible via delegation.

HTH

Cheers
>
>
> On Thu, Jun 12, 2008 at 11:19 AM, Richard S. Hall <he...@ungoverned.org>
> wrote:
>
> > You can install a reference to an exploded bundle JAR directory using
> that
> > syntax:
> >
> >   reference:file:/path/to/exploded/jar
> >
> > -> richard
> >
> > Daniel Veljjanoski wrote:
> >
> >> Hi,
> >>
> >>
> >>  Is it possible to have a package (Folder) as a bundle ( NOT jar file)?
> >>
> >> Something like the line below ( in the felix config file ) :
> >>
> >>
> >>  felix.auto.start.1=
> >>
> reference:file:net/java/sip/communicator/util/<file:///mybundle/util.jar>
> >>
> >>
> >>  instead of :
> >>
> >>
> >>  felix.auto.start.1=
> >> reference:file:sc-bundles/util.jar<file:///mybundle/util.jar>
> >>
> >>
> >>  Using the second line everything work fine for me, BUT, I want to work
> on
> >> the SIP Communicator using eclipse.
> >>
> >> My idea is to make development faster.
> >>
> >>
> >>  -- Way?
> >>
> >> Until now I proceed like on description below :
> >>
> >>
> >>
> >>   1.
> >>
> >>   Coding..
> >>   2.
> >>
> >>   Using "Make" from Eclipse->ANT->build.xml
> >>   3.
> >>
> >>   Using "Run" from Eclipse to run the project ( Or "Run" from Eclipse
> >> ->ANT
> >>   )
> >>
> >> I want to eliminate the point 2. because "Make" spend a lot of time
> during
> >> :
> >>
> >>   1.
> >>
> >>   Compilation of the code
> >>   2.
> >>
> >>   Make a Packages ( jar files - plugins)
> >>
> >>
> >>  --How to?
> >>
> >> I think that is possible because using eclipse doesn't need to recompile
> >> the
> >> code, and we don't need to make a changes in the build.xml for do that -
> >> if
> >> Felix can start/install a bundle from folder (eclipse package).
> >>
> >>
> >>  The goal is to have a simple eclipse project :
> >>
> >>   -
> >>
> >>   Coding...
> >>   -
> >>
> >>   Using "Run" from Eclipse to run the project.
> >>
> >>
> >>  Any suggestions please...?
> >>
> >>
> >>  Excuse for my English.
> >>
> >>
> >>  Cheers
> >>
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>
>
> --
> Daniel VELJJANOSKI
>



-- 
Cheers, Stuart

Re: Start / Install - Felix Bundle

Posted by Daniel Veljjanoski <da...@gmail.com>.
Hi Richard,


 Thanks a lot for your answer, it work fine for me but there is two
conditions :

  reference:file:/path/to/exploded/jar


   1.

   The folder named  "jar" in the examle above MUST contains
   META-INF/MANIFEST.MF
   2.

   I have changed the Felix.java :


 *private* BundleActivator createBundleActivator(BundleInfo info){

...

// Class clazz = info.getCurrentModule().getClass(className);

// Adding a line below just after the line above.

*if*(clazz == *null*) clazz= Class.*forName*(className);

...


 Cheers


On Thu, Jun 12, 2008 at 11:19 AM, Richard S. Hall <he...@ungoverned.org>
wrote:

> You can install a reference to an exploded bundle JAR directory using that
> syntax:
>
>   reference:file:/path/to/exploded/jar
>
> -> richard
>
> Daniel Veljjanoski wrote:
>
>> Hi,
>>
>>
>>  Is it possible to have a package (Folder) as a bundle ( NOT jar file)?
>>
>> Something like the line below ( in the felix config file ) :
>>
>>
>>  felix.auto.start.1=
>> reference:file:net/java/sip/communicator/util/<file:///mybundle/util.jar>
>>
>>
>>  instead of :
>>
>>
>>  felix.auto.start.1=
>> reference:file:sc-bundles/util.jar<file:///mybundle/util.jar>
>>
>>
>>  Using the second line everything work fine for me, BUT, I want to work on
>> the SIP Communicator using eclipse.
>>
>> My idea is to make development faster.
>>
>>
>>  -- Way?
>>
>> Until now I proceed like on description below :
>>
>>
>>
>>   1.
>>
>>   Coding..
>>   2.
>>
>>   Using "Make" from Eclipse->ANT->build.xml
>>   3.
>>
>>   Using "Run" from Eclipse to run the project ( Or "Run" from Eclipse
>> ->ANT
>>   )
>>
>> I want to eliminate the point 2. because "Make" spend a lot of time during
>> :
>>
>>   1.
>>
>>   Compilation of the code
>>   2.
>>
>>   Make a Packages ( jar files - plugins)
>>
>>
>>  --How to?
>>
>> I think that is possible because using eclipse doesn't need to recompile
>> the
>> code, and we don't need to make a changes in the build.xml for do that -
>> if
>> Felix can start/install a bundle from folder (eclipse package).
>>
>>
>>  The goal is to have a simple eclipse project :
>>
>>   -
>>
>>   Coding...
>>   -
>>
>>   Using "Run" from Eclipse to run the project.
>>
>>
>>  Any suggestions please...?
>>
>>
>>  Excuse for my English.
>>
>>
>>  Cheers
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Daniel VELJJANOSKI

Re: Start / Install - Felix Bundle

Posted by "Richard S. Hall" <he...@ungoverned.org>.
You can install a reference to an exploded bundle JAR directory using 
that syntax:

    reference:file:/path/to/exploded/jar

-> richard

Daniel Veljjanoski wrote:
> Hi,
>
>
>  Is it possible to have a package (Folder) as a bundle ( NOT jar file)?
>
> Something like the line below ( in the felix config file ) :
>
>
>  felix.auto.start.1=
> reference:file:net/java/sip/communicator/util/<file:///mybundle/util.jar>
>
>
>  instead of :
>
>
>  felix.auto.start.1=
> reference:file:sc-bundles/util.jar<file:///mybundle/util.jar>
>
>
>  Using the second line everything work fine for me, BUT, I want to work on
> the SIP Communicator using eclipse.
>
> My idea is to make development faster.
>
>
>  -- Way?
>
> Until now I proceed like on description below :
>
>
>
>    1.
>
>    Coding..
>    2.
>
>    Using "Make" from Eclipse->ANT->build.xml
>    3.
>
>    Using "Run" from Eclipse to run the project ( Or "Run" from Eclipse ->ANT
>    )
>
> I want to eliminate the point 2. because "Make" spend a lot of time during :
>
>    1.
>
>    Compilation of the code
>    2.
>
>    Make a Packages ( jar files - plugins)
>
>
>  --How to?
>
> I think that is possible because using eclipse doesn't need to recompile the
> code, and we don't need to make a changes in the build.xml for do that - if
> Felix can start/install a bundle from folder (eclipse package).
>
>
>  The goal is to have a simple eclipse project :
>
>    -
>
>    Coding...
>    -
>
>    Using "Run" from Eclipse to run the project.
>
>
>  Any suggestions please...?
>
>
>  Excuse for my English.
>
>
>  Cheers
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org