Re: [Dev] [APIM] [OSGI] Removal of dynamic imports causes CNF on extention points

2015-10-21 Thread Shani Ranasinghe
Thanks KasunG & Kishanthan for the inputs.

On Mon, Oct 19, 2015 at 10:49 AM, Kishanthan Thangarajah <
kishant...@wso2.com> wrote:

>
>
> On Fri, Oct 16, 2015 at 4:31 PM, Shani Ranasinghe  wrote:
>
>>
>> Hi,
>>
>> In APIM current code (1.10), we have removed the > >* from all packages at the moment.
>>
>> We faced an issue now, where an extension point would not work with this
>> change. i.e. if we put a external jar into the
>> /repository/components/lib folder, that class will not be picked
>> up by the component OSGI bundle because of the aforementioned reason.
>>
>> Discussing with KasunG, I learned that we cannot remove the 
>> DynamicImport-Package
>> statement, if the components use Class.forName() or 
>> .class.getClassLoader().loadClass();
>> because the OSGI bundle would not be able to identify the external class.
>>
>> As a possible solution, what we thought of is, to move the Class.forName()
>> to a central location, possibily to the org.wso2.carbon.apimgt.impl
>> package, and have the
>> * to that package. Then
>> all other packages that used to have the Class.forName() can be referred to
>> the method introduced in the org.wso2.carbon.apimgt.impl package.
>>
>> @KasunG, Kishanthan, is this the correct approach?
>>
>
> This will not work. DynamicImport-Package :   (or
> org.wso2.carbon.apimgt.impl) means, you do not know that this package will
> be available at runtime in advance so that bundle resolution process will
> not take this package into account when resolving the bundle import
> statements. It will only try to resolve this package when it is requested
> to be loaded.
>
> For packages (mostly if its extensions) we will not know the package name
> in advance too, and for situations like this we will have to use the "*"
> with dynamic import. We do not have any other ways to solve this when
> loading classes using Class.forName and we do not know the package names in
> advance.
>
>
>> Are there any other approaches that we could look into?
>> --
>> Thanks and Regards
>> *,Shani Ranasinghe*
>> Senior Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 77 2273555
>> Blog: http://waysandmeans.blogspot.com/
>> linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
>>
>
>
>
> --
> *Kishanthan Thangarajah*
> Associate Technical Lead,
> Platform Technologies Team,
> WSO2, Inc.
> lean.enterprise.middleware
>
> Mobile - +94773426635
> Blog - *http://kishanthan.wordpress.com *
> Twitter - *http://twitter.com/kishanthan *
>



-- 
Thanks and Regards
*,Shani Ranasinghe*
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 77 2273555
Blog: http://waysandmeans.blogspot.com/
linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] [OSGI] Removal of dynamic imports causes CNF on extention points

2015-10-18 Thread Kishanthan Thangarajah
On Fri, Oct 16, 2015 at 4:31 PM, Shani Ranasinghe  wrote:

>
> Hi,
>
> In APIM current code (1.10), we have removed the  >* from all packages at the moment.
>
> We faced an issue now, where an extension point would not work with this
> change. i.e. if we put a external jar into the
> /repository/components/lib folder, that class will not be picked
> up by the component OSGI bundle because of the aforementioned reason.
>
> Discussing with KasunG, I learned that we cannot remove the 
> DynamicImport-Package
> statement, if the components use Class.forName() or 
> .class.getClassLoader().loadClass();
> because the OSGI bundle would not be able to identify the external class.
>
> As a possible solution, what we thought of is, to move the Class.forName()
> to a central location, possibily to the org.wso2.carbon.apimgt.impl
> package, and have the
> * to that package. Then
> all other packages that used to have the Class.forName() can be referred to
> the method introduced in the org.wso2.carbon.apimgt.impl package.
>
> @KasunG, Kishanthan, is this the correct approach?
>

This will not work. DynamicImport-Package :   (or
org.wso2.carbon.apimgt.impl) means, you do not know that this package will
be available at runtime in advance so that bundle resolution process will
not take this package into account when resolving the bundle import
statements. It will only try to resolve this package when it is requested
to be loaded.

For packages (mostly if its extensions) we will not know the package name
in advance too, and for situations like this we will have to use the "*"
with dynamic import. We do not have any other ways to solve this when
loading classes using Class.forName and we do not know the package names in
advance.


> Are there any other approaches that we could look into?
> --
> Thanks and Regards
> *,Shani Ranasinghe*
> Senior Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 77 2273555
> Blog: http://waysandmeans.blogspot.com/
> linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
>



-- 
*Kishanthan Thangarajah*
Associate Technical Lead,
Platform Technologies Team,
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94773426635
Blog - *http://kishanthan.wordpress.com *
Twitter - *http://twitter.com/kishanthan *
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] [OSGI] Removal of dynamic imports causes CNF on extention points

2015-10-18 Thread Shani Ranasinghe
Hi,


On Sun, Oct 18, 2015 at 2:25 PM, KasunG Gajasinghe  wrote:

>
>
> On Fri, Oct 16, 2015 at 4:31 PM, Shani Ranasinghe  wrote:
>
>>
>> Hi,
>>
>> In APIM current code (1.10), we have removed the > >* from all packages at the moment.
>>
>> We faced an issue now, where an extension point would not work with this
>> change. i.e. if we put a external jar into the
>> /repository/components/lib folder, that class will not be picked
>> up by the component OSGI bundle because of the aforementioned reason.
>>
>> Discussing with KasunG, I learned that we cannot remove the 
>> DynamicImport-Package
>> statement, if the components use Class.forName() or 
>> .class.getClassLoader().loadClass();
>> because the OSGI bundle would not be able to identify the external class.
>>
>> As a possible solution, what we thought of is, to move the Class.forName()
>> to a central location, possibily to the org.wso2.carbon.apimgt.impl
>> package, and have the
>> * to that package. Then
>> all other packages that used to have the Class.forName() can be referred to
>> the method introduced in the org.wso2.carbon.apimgt.impl package.
>>
>
> Did you mean the org.wso2.carbon.apimgt.impl component?
>

Yes, that is what I meant. All other components  that use a Class.forName()
refer to this component.

>
>
>> @KasunG, Kishanthan, is this the correct approach?
>>
>> Are there any other approaches that we could look into?
>> --
>> Thanks and Regards
>> *,Shani Ranasinghe*
>> Senior Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 77 2273555
>> Blog: http://waysandmeans.blogspot.com/
>> linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
>>
>
>
>
> --
>
> *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
> email: kasung AT spamfree wso2.com
> linked-in: http://lk.linkedin.com/in/gajasinghe
> blog: http://kasunbg.org
>
>
>



-- 
Thanks and Regards
*,Shani Ranasinghe*
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 77 2273555
Blog: http://waysandmeans.blogspot.com/
linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] [OSGI] Removal of dynamic imports causes CNF on extention points

2015-10-18 Thread KasunG Gajasinghe
On Fri, Oct 16, 2015 at 4:31 PM, Shani Ranasinghe  wrote:

>
> Hi,
>
> In APIM current code (1.10), we have removed the  >* from all packages at the moment.
>
> We faced an issue now, where an extension point would not work with this
> change. i.e. if we put a external jar into the
> /repository/components/lib folder, that class will not be picked
> up by the component OSGI bundle because of the aforementioned reason.
>
> Discussing with KasunG, I learned that we cannot remove the 
> DynamicImport-Package
> statement, if the components use Class.forName() or 
> .class.getClassLoader().loadClass();
> because the OSGI bundle would not be able to identify the external class.
>
> As a possible solution, what we thought of is, to move the Class.forName()
> to a central location, possibily to the org.wso2.carbon.apimgt.impl
> package, and have the
> * to that package. Then
> all other packages that used to have the Class.forName() can be referred to
> the method introduced in the org.wso2.carbon.apimgt.impl package.
>

Did you mean the org.wso2.carbon.apimgt.impl component?


> @KasunG, Kishanthan, is this the correct approach?
>
> Are there any other approaches that we could look into?
> --
> Thanks and Regards
> *,Shani Ranasinghe*
> Senior Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 77 2273555
> Blog: http://waysandmeans.blogspot.com/
> linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
>



-- 

*Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
email: kasung AT spamfree wso2.com
linked-in: http://lk.linkedin.com/in/gajasinghe
blog: http://kasunbg.org
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [APIM] [OSGI] Removal of dynamic imports causes CNF on extention points

2015-10-16 Thread Shani Ranasinghe
Hi,

In APIM current code (1.10), we have removed the * from all packages at the moment.

We faced an issue now, where an extension point would not work with this
change. i.e. if we put a external jar into the
/repository/components/lib folder, that class will not be picked
up by the component OSGI bundle because of the aforementioned reason.

Discussing with KasunG, I learned that we cannot remove the
DynamicImport-Package
statement, if the components use Class.forName() or
.class.getClassLoader().loadClass();
because the OSGI bundle would not be able to identify the external class.

As a possible solution, what we thought of is, to move the Class.forName()
to a central location, possibily to the org.wso2.carbon.apimgt.impl
package, and have the
* to that package. Then all
other packages that used to have the Class.forName() can be referred to the
method introduced in the org.wso2.carbon.apimgt.impl package.

@KasunG, Kishanthan, is this the correct approach?

Are there any other approaches that we could look into?
-- 
Thanks and Regards
*,Shani Ranasinghe*
Senior Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: +94 77 2273555
Blog: http://waysandmeans.blogspot.com/
linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev