Re: [osgi-dev] wire admin add packages

2014-06-09 Thread Thomas Watson

By wire admin I assume you don't really mean the WireAdmin service [1].
That service is completely on top of the framework and not related to
bundle wiring.

Here I assume you mean the bundle wiring API [2].  First I will tell you
how it can be done, but then I want you to give the reason you need to do
this, because there likely is a better way to accomplish what you need.

The only way you can dynamically add package imports is to use a
WeavingHook [3].  For each bundle class load your WeavingHook.weave method
will be called with a WovenClass object.  The WovenClass object has a
method getDynamicImports [5] that allows a hook to add more dynamic imports
to the bundle as needed.  The intended purpose of this method is to allow a
weaving hook to add more package imports that may be needed by the code
that is being woven into the class.  But you obviously can choose to do it
for any other reason you want to.  Keep in mind the dynamic imports added
by weaving hooks are not persistent and have to be redone each time a new
class loader is created for the bundle (i.e. on framework restart or bundle
refresh).

Tom

[1]
http://www.osgi.org/javadoc/r5/cmpn/org/osgi/service/wireadmin/package-summary.html
[2]
http://www.osgi.org/javadoc/r6/core/org/osgi/framework/wiring/package-summary.html
[3]
http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html

[4]
http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html#weave
(org.osgi.framework.hooks.weaving.WovenClass)
[5]
http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WovenClass.html#getDynamicImports
()



From:   Raymond Auge raymond.a...@liferay.com
To: OSGi Developer Mail List osgi-dev@mail.osgi.org
Date:   06/09/2014 09:04 AM
Subject:[osgi-dev] wire admin add packages
Sent by:osgi-dev-boun...@mail.osgi.org



Is it possible to use wireadmin to add new package imports to bundles
dynamically?

--
Raymond Augé (@rotty3000)
Senior Software Architect
Liferay, Inc. (@Liferay)
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] wire admin add packages

2014-06-09 Thread Raymond Auge
Ok so weaving is limited to r6.. not good news.

I'm working on the JSP case. But I'm going to look at the equinox jsp
bundles to see if that can work for us.

Thanks,

- Ray


On Mon, Jun 9, 2014 at 10:36 AM, Thomas Watson tjwat...@us.ibm.com wrote:

 By wire admin I assume you don't really mean the WireAdmin service [1].
  That service is completely on top of the framework and not related to
 bundle wiring.

 Here I assume you mean the bundle wiring API [2].  First I will tell you
 how it can be done, but then I want you to give the reason you need to do
 this, because there likely is a better way to accomplish what you need.

 The only way you can dynamically add package imports is to use a
 WeavingHook [3].  For each bundle class load your WeavingHook.weave method
 will be called with a WovenClass object.  The WovenClass object has a
 method getDynamicImports [5] that allows a hook to add more dynamic imports
 to the bundle as needed.  The intended purpose of this method is to allow a
 weaving hook to add more package imports that may be needed by the code
 that is being woven into the class.  But you obviously can choose to do it
 for any other reason you want to.  Keep in mind the dynamic imports added
 by weaving hooks are not persistent and have to be redone each time a new
 class loader is created for the bundle (i.e. on framework restart or bundle
 refresh).

 Tom

 [1]
 http://www.osgi.org/javadoc/r5/cmpn/org/osgi/service/wireadmin/package-summary.html
 [2]
 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/wiring/package-summary.html
 [3]
 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html
 [4]
 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html#weave(org.osgi.framework.hooks.weaving.WovenClass)
 [5]
 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WovenClass.html#getDynamicImports()

 [image: Inactive hide details for Raymond Auge ---06/09/2014 09:04:21
 AM---Is it possible to use wireadmin to add new package imports t]Raymond
 Auge ---06/09/2014 09:04:21 AM---Is it possible to use wireadmin to add new
 package imports to bundles dynamically?

 From: Raymond Auge raymond.a...@liferay.com
 To: OSGi Developer Mail List osgi-dev@mail.osgi.org
 Date: 06/09/2014 09:04 AM
 Subject: [osgi-dev] wire admin add packages
 Sent by: osgi-dev-boun...@mail.osgi.org
 --



 Is it possible to use wireadmin to add new package imports to bundles
 dynamically?

 --
 *Raymond Augé* http://www.liferay.com/web/raymond.auge/profile
  (@rotty3000)
 Senior Software Architect
 *Liferay, Inc.* http://www.liferay.com/ (@Liferay)
 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev


 ___
 OSGi Developer Mail List
 osgi-dev@mail.osgi.org
 https://mail.osgi.org/mailman/listinfo/osgi-dev




-- 
*Raymond Augé* http://www.liferay.com/web/raymond.auge/profile
 (@rotty3000)
Senior Software Architect
*Liferay, Inc.* http://www.liferay.com (@Liferay)
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] wire admin add packages

2014-06-09 Thread Raymond Auge
Interesting, I may need that, but I solved the first step at least without
it using the Wiring APIs, which are awesome btw.

- Ray


On Mon, Jun 9, 2014 at 11:12 AM, Thomas Watson tjwat...@us.ibm.com wrote:

 Note the WeavingHook is also available in R5:
 http://www.osgi.org/javadoc/r5/core/org/osgi/framework/hooks/weaving/package-summary.html

 Tom



 [image: Inactive hide details for Raymond Auge ---06/09/2014 10:07:26
 AM---Ok so weaving is limited to r6.. not good news. I'm working]Raymond
 Auge ---06/09/2014 10:07:26 AM---Ok so weaving is limited to r6.. not good
 news. I'm working on the JSP case. But I'm going to look a


 From: Raymond Auge raymond.a...@liferay.com
 To: OSGi Developer Mail List osgi-dev@mail.osgi.org
 Date: 06/09/2014 10:07 AM
 Subject: Re: [osgi-dev] wire admin add packages

 Sent by: osgi-dev-boun...@mail.osgi.org
 --



 Ok so weaving is limited to r6.. not good news.

 I'm working on the JSP case. But I'm going to look at the equinox jsp
 bundles to see if that can work for us.

 Thanks,

 - Ray


 On Mon, Jun 9, 2014 at 10:36 AM, Thomas Watson *tjwat...@us.ibm.com*
 tjwat...@us.ibm.com wrote:

By wire admin I assume you don't really mean the WireAdmin service
[1].  That service is completely on top of the framework and not related to
bundle wiring.

Here I assume you mean the bundle wiring API [2].  First I will tell
you how it can be done, but then I want you to give the reason you need to
do this, because there likely is a better way to accomplish what you need.

The only way you can dynamically add package imports is to use a
WeavingHook [3].  For each bundle class load your WeavingHook.weave method
will be called with a WovenClass object.  The WovenClass object has a
method getDynamicImports [5] that allows a hook to add more dynamic imports
to the bundle as needed.  The intended purpose of this method is to allow a
weaving hook to add more package imports that may be needed by the code
that is being woven into the class.  But you obviously can choose to do it
for any other reason you want to.  Keep in mind the dynamic imports added
by weaving hooks are not persistent and have to be redone each time a new
class loader is created for the bundle (i.e. on framework restart or bundle
refresh).

Tom

[1]

 *http://www.osgi.org/javadoc/r5/cmpn/org/osgi/service/wireadmin/package-summary.html*

 http://www.osgi.org/javadoc/r5/cmpn/org/osgi/service/wireadmin/package-summary.html
[2]

 *http://www.osgi.org/javadoc/r6/core/org/osgi/framework/wiring/package-summary.html*

 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/wiring/package-summary.html
[3]

 *http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html*

 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html
[4]

 *http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html#weave(org.osgi.framework.hooks.weaving.WovenClass)*

 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WeavingHook.html#weave(org.osgi.framework.hooks.weaving.WovenClass)
[5]

 *http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WovenClass.html#getDynamicImports()*

 http://www.osgi.org/javadoc/r6/core/org/osgi/framework/hooks/weaving/WovenClass.html#getDynamicImports()

[image: Inactive hide details for Raymond Auge ---06/09/2014 09:04:21
AM---Is it possible to use wireadmin to add new package imports t]Raymond
Auge ---06/09/2014 09:04:21 AM---Is it possible to use wireadmin to add new
package imports to bundles dynamically?

From: Raymond Auge *raymond.a...@liferay.com*
raymond.a...@liferay.com
To: OSGi Developer Mail List *osgi-dev@mail.osgi.org*
osgi-dev@mail.osgi.org
Date: 06/09/2014 09:04 AM
Subject: [osgi-dev] wire admin add packages
Sent by: *osgi-dev-boun...@mail.osgi.org*
osgi-dev-boun...@mail.osgi.org
--




Is it possible to use wireadmin to add new package imports to bundles
dynamically?

--
 *Raymond Augé* http://www.liferay.com/web/raymond.auge/profile
 (@rotty3000)
Senior Software Architect
 *Liferay, Inc.* http://www.liferay.com/ (@Liferay)
___
OSGi Developer Mail List
 *osgi-dev@mail.osgi.org* osgi-dev@mail.osgi.org
 *https://mail.osgi.org/mailman/listinfo/osgi-dev*
https://mail.osgi.org/mailman/listinfo/osgi-dev

___
OSGi Developer Mail List
 *osgi-dev@mail.osgi.org* osgi-dev@mail.osgi.org
 *https://mail.osgi.org/mailman/listinfo/osgi-dev*
https://mail.osgi.org/mailman/listinfo/osgi-dev




 --
 *Raymond Augé* http://www.liferay.com/web/raymond.auge/profile
  (@rotty3000)
 Senior Software Architect
 *Liferay, Inc.* http://www.liferay.com