On Fri, Oct 16, 2015 at 4:31 PM, Shani Ranasinghe <sh...@wso2.com> wrote:
> > Hi, > > In APIM current code (1.10), we have removed the <DynamicImport-Package > >*</DynamicImport-Package> 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 > <APIM_HOME>/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 > <ClassName>.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 > <DynamicImport-Package>*</DynamicImport-Package> 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 : <some-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 <http://kishanthan.wordpress.com>* Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev