MdsBundleHelper

public final class MdsBundleHelper

Helper class, that provides utility methods for MDS OSGi bundles.

Methods

findMdsBundle

public static Bundle findMdsBundle(BundleContext bundleContext)

findMdsEntitiesBundle

public static Bundle findMdsEntitiesBundle(BundleContext bundleContext)

getMdsBundleClassLoader

public static ClassLoader getMdsBundleClassLoader(BundleContext bundleContext)

Returns the Bundle ClassLoader of the MDS bundle.

Parameters:
  • bundleContext – the bundle context from which the MDS bundle should get retrieved from
Returns:

the MDS bundle ClassLoader

getMdsEntitiesBundleClassLoader

public static ClassLoader getMdsEntitiesBundleClassLoader(BundleContext bundleContext)

Returns the Bundle ClassLoader of the MDS Entities bundle.

Parameters:
  • bundleContext – the bundle context from which the MDS Entities bundle should get retrieved from
Returns:

the MDS bundle ClassLoader

isBundleMdsDependent

public static boolean isBundleMdsDependent(Bundle bundle)

isFrameworkBundle

public static boolean isFrameworkBundle(Bundle bundle)

isMdsBundle

public static boolean isMdsBundle(Bundle bundle)

isMdsClassLoader

public static boolean isMdsClassLoader(ClassLoader classLoader)

isMdsEntitiesBundle

public static boolean isMdsEntitiesBundle(Bundle bundle)

searchForBundle

public static Bundle searchForBundle(BundleContext context, Entity entity)

Method used to retrieve bundle of the entity passed as a parameter. It converts Entity object to EntityDto and then tries to find bundle basing on module symbolic name. If module symbolic name is null it retrieves bundle basing on module name.

Parameters:
  • context – BundleContext to be searched
  • entity – Entity for which bundle is searched
Returns:

Bundle of the entity passed as a parameter

searchForBundle

public static Bundle searchForBundle(BundleContext context, EntityDto entity)

Method used to retrieve bundle of the entity dto passed as a parameter. It tries to find bundle basing on module symbolic name. If module symbolic name is null it retrieves bundle basing on module name.

Parameters:
  • context – BundleContext to be searched
  • entity – EntityDto for which bundle is searched
Returns:

Bundle of the entity dto passed as a parameter

unregisterBundleJDOClasses

public static void unregisterBundleJDOClasses(Bundle bundle)

Unregisters all entity classes registered to JDO that are accessible from bundle class loader. This method should be called after bundle that registers MDS entities gets unresolved, so that they are removed from JDO cache. Not doing this might produce hard to track exception when refreshing MDS Entities Bundle after bundle removal.

Parameters:
  • bundle – the bundle for which entity classes are to be unregistered