Interface RuntimeContext

    • Method Detail

      • getBundle

        org.osgi.framework.Bundle getBundle()
        Gets the container bundle or null if we are not running in an OSGi environment.
      • getComponents

        ComponentName[] getComponents()
        Get the component names deployed by this context
        Returns:
        the list of components. Return an empty array if no components where deployed.
        Since:
        9.2
      • getLocalResource

        URL getLocalResource​(String name)
        Finds a local resource having the given name.

        Only the current bundle should be searched for the resource.

        Parameters:
        name - the local resource name
        Returns:
        an URL to the resource having that name or null if not was found
        See Also:
        ClassLoader.getResource(String)
      • deploy

        RegistrationInfo deploy​(URL url)
                         throws IOException
        Deploys a component XML descriptor given its URL.

        Do nothing if component is already deployed.

        Returns the registration info of the new deployed component or null if the component was not deployed.

        Parameters:
        url - the url of the XML descriptor
        Returns:
        the component registration info or null if registration failed for some reason
        Throws:
        IOException
      • undeploy

        void undeploy​(URL url)
               throws IOException
        Undeploys a component XML descriptor given its URL.

        Do nothing if no component was registered for the given URL.

        Parameters:
        url - the URL of the XML descriptor
        Throws:
        IOException
      • isDeployed

        boolean isDeployed​(URL url)
        Checks whether the component XML file at given URL was deployed.
        Parameters:
        url - the URL to check
        Returns:
        true it deployed, false otherwise
      • isDeployed

        boolean isDeployed​(StreamRef ref)
        Checks whether the component XML file given by the StreamRef argument was deployed.
      • deploy

        RegistrationInfo deploy​(String location)
        Deploys the component whose XML descriptor is at the given location.

        If the component is already deployed do nothing.

        The location is interpreted as a relative path inside the bundle (jar) containing the component - and will be loaded using getLocalResource(String).

        Returns the registration info of the new deployed component or null if the component was not deployed.

        Parameters:
        location - the location
        Returns:
        the component registration info or null if registration failed for some reason
      • undeploy

        void undeploy​(String location)
        Undeploys the component at the given location if any was deployed.

        If the component was not deployed do nothing.

        Parameters:
        location - the location of the component to undeploy
      • isDeployed

        boolean isDeployed​(String location)
        Checks if the component at the given location is deployed.
        Parameters:
        location - the component location to check
        Returns:
        true if deployed, false otherwise
      • destroy

        void destroy()
        Destroys this context.