}
private void listImportExport( JSONWriter jw, Bundle bundle, final String pluginRoot ) throws JSONException
{
PackageAdmin packageAdmin = getPackageAdmin();
if ( packageAdmin == null )
{
return;
}
Map usingBundles = new TreeMap();
ExportedPackage[] exports = packageAdmin.getExportedPackages( bundle );
if ( exports != null && exports.length > 0 )
{
// do alphabetical sort
Arrays.sort( exports, new Comparator()
{
public int compare( ExportedPackage p1, ExportedPackage p2 )
{
return p1.getName().compareTo( p2.getName() );
}
public int compare( Object o1, Object o2 )
{
return compare( ( ExportedPackage ) o1, ( ExportedPackage ) o2 );
}
} );
JSONArray val = new JSONArray();
for ( int j = 0; j < exports.length; j++ )
{
ExportedPackage export = exports[j];
collectExport( val, export.getName(), export.getVersion() );
Bundle[] ubList = export.getImportingBundles();
if ( ubList != null )
{
for ( int i = 0; i < ubList.length; i++ )
{
Bundle ub = ubList[i];
String name = ub.getSymbolicName();
if (name == null) name = ub.getLocation();
usingBundles.put( name, ub );
}
}
}
WebConsoleUtil.keyVal( jw, "Exported Packages", val );
}
else
{
WebConsoleUtil.keyVal( jw, "Exported Packages", "---" );
}
exports = packageAdmin.getExportedPackages( ( Bundle ) null );
if ( exports != null && exports.length > 0 )
{
// collect import packages first
final List imports = new ArrayList();
for ( int i = 0; i < exports.length; i++ )