org.apache.struts2.osgi

## Class OsgiUtil

- java.lang.Object
- - org.apache.struts2.osgi.OsgiUtil

-     public class OsgiUtil
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OsgiUtil()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsBean(Object beanFactory, String beanId)` Calls containsBean on the passed object using refelection.
    `static Object` | `getBean(Object beanFactory, String beanId)` Calls getBean() on the passed object using refelection.
    `static URL` | `translateBundleURLToJarURL(URL bundleUrl, org.osgi.framework.Bundle bundle)` A bundle is a jar, and a bundle URL will be useless to clients, this method translates a URL to a resource inside a bundle from "bundle:something/path" to "jar:file:bundlelocation!/path"

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OsgiUtil

          public OsgiUtil()

  - ### Method Detail

    - #### translateBundleURLToJarURL

          public static URL translateBundleURLToJarURL(URL bundleUrl,
                                       org.osgi.framework.Bundle bundle)
                                                throws MalformedURLException

      A bundle is a jar, and a bundle URL will be useless to clients, this method translates a URL to a resource inside a bundle from "bundle:something/path" to "jar:file:bundlelocation!/path"
      Parameters:
        `bundleUrl` - URL to translate
        `bundle` - the bundle
      Returns:
        translated URL
      Throws:
        `MalformedURLException` - if url is malformed

    - #### getBean

          public static Object getBean(Object beanFactory,
                       String beanId)

      Calls getBean() on the passed object using refelection. Used on Spring context because they are loaded from bundles (in anothe class loader)
      Parameters:
        `beanFactory` - bean factory
        `beanId` - id of bean
      Returns:
        the object found

    - #### containsBean

          public static boolean containsBean(Object beanFactory,
                             String beanId)

      Calls containsBean on the passed object using refelection. Used on Spring context because they are loaded from bundles (in anothe class loader)
      Parameters:
        `beanFactory` - bean factory
        `beanId` - id of bean
      Returns:
        true if bean factory contains bean with bean id

Copyright © 2000–2018 Apache Software Foundation. All rights reserved.