Nuxeo Enterprise Platform 5.1

org.nuxeo.runtime.model
Interface RuntimeContext

All Known Implementing Classes:
DefaultRuntimeContext, JBossRuntimeContext, OSGiRuntimeContext, RemoteContext

public interface RuntimeContext

The runtime context.

Runtime contexts are used to create components. They provides custom methods to load classes and find resources.

Runtime contexts are generally attached to a bundle context (or module deployment context)

Author:
Bogdan Stefanescu

Method Summary
 void deploy(String location)
          Deploys the component whose XML descriptor is at the given location.
 void deploy(URL url)
          Deploys a component XML descriptor given its URL.
 void destroy()
          Destroys this context.
 org.osgi.framework.Bundle getBundle()
          Gets the container bundle or null if we are not running in an OSGi environment.
 URL getLocalResource(String name)
          Finds a local resource having the given name.
 URL getResource(String name)
          Finds a resource having the given name.
 RuntimeService getRuntime()
          Gets the curent runtime service.
 boolean isDeployed(String location)
          Checks if the component at the given location is deployed.
 boolean isDeployed(URL url)
          Checks whether the component XML file at given URL was deployeds.
 Class loadClass(String className)
          Loads the class given its name.
 void undeploy(String location)
          Undeploys the component at the given location if any was deployed.
 void undeploy(URL url)
          Undeploys a component XML descriptor given its URL.
 

Method Detail

getRuntime

RuntimeService getRuntime()
Gets the curent runtime service.

Returns:
the runtime service

getBundle

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


loadClass

Class loadClass(String className)
                throws ClassNotFoundException
Loads the class given its name.

Parameters:
className - the class name
Returns:
the class object
Throws:
ClassNotFoundException - if no such class were found
See Also:
ClassLoader.loadClass(String)

getResource

URL getResource(String name)
Finds a resource having the given name.

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

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

void deploy(URL url)
            throws Exception
Deploys a component XML descriptor given its URL.

Do nothing if component is already deployed.

Parameters:
url - the url of the XML descriptor
Throws:
Exception - if any error occurs

undeploy

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

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

Parameters:
url - the url of the XML descriptor
Throws:
Exception - if any error occurs

isDeployed

boolean isDeployed(URL url)
Checks whether the component XML file at given URL was deployeds.

Parameters:
url - the url to check
Returns:
true it deployed, false otherwise

deploy

void deploy(String location)
            throws Exception
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).

Parameters:
location - the location
Throws:
Exception

undeploy

void undeploy(String location)
              throws Exception
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
Throws:
Exception - if any error occurs

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.


Nuxeo Enterprise Platform 5.1

Copyright ? 2007 Nuxeo SAS. All Rights Reserved.