Nuxeo Enterprise Platform 5.4

org.nuxeo.runtime.model
Interface RuntimeContext

All Known Implementing Classes:
DefaultRuntimeContext, 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
 RegistrationInfo deploy(StreamRef ref)
          Same as deploy(URL) but using a StreamRef as argument.
 RegistrationInfo deploy(java.lang.String location)
          Deploys the component whose XML descriptor is at the given location.
 RegistrationInfo deploy(java.net.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.
 java.net.URL getLocalResource(java.lang.String name)
          Finds a local resource having the given name.
 java.net.URL getResource(java.lang.String name)
          Finds a resource having the given name.
 RuntimeService getRuntime()
          Gets the current runtime service.
 boolean isDeployed(StreamRef ref)
          Checks whether the component XML file given by the StreamRef argument was deployed.
 boolean isDeployed(java.lang.String location)
          Checks if the component at the given location is deployed.
 boolean isDeployed(java.net.URL url)
          Checks whether the component XML file at given URL was deployed.
 java.lang.Class<?> loadClass(java.lang.String className)
          Loads the class given its name.
 void undeploy(StreamRef ref)
          Same as undeploy(URL) but using a StreamRef as stream reference.
 void undeploy(java.lang.String location)
          Undeploys the component at the given location if any was deployed.
 void undeploy(java.net.URL url)
          Undeploys a component XML descriptor given its URL.
 

Method Detail

getRuntime

RuntimeService getRuntime()
Gets the current 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

java.lang.Class<?> loadClass(java.lang.String className)
                             throws java.lang.ClassNotFoundException
Loads the class given its name.

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

getResource

java.net.URL getResource(java.lang.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

java.net.URL getLocalResource(java.lang.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(java.net.URL url)
                        throws java.lang.Exception
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:
java.lang.Exception - if any error occurs

deploy

RegistrationInfo deploy(StreamRef ref)
                        throws java.lang.Exception
Same as deploy(URL) but using a StreamRef as argument.

Parameters:
ref -
Returns:
Throws:
java.lang.Exception

undeploy

void undeploy(java.net.URL url)
              throws java.lang.Exception
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:
java.lang.Exception - if any error occurs

undeploy

void undeploy(StreamRef ref)
              throws java.lang.Exception
Same as undeploy(URL) but using a StreamRef as stream reference.

Parameters:
ref -
Throws:
java.lang.Exception

isDeployed

boolean isDeployed(java.net.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.

Parameters:
ref -
Returns:

deploy

RegistrationInfo deploy(java.lang.String location)
                        throws java.lang.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).

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
Throws:
java.lang.Exception

undeploy

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

isDeployed

boolean isDeployed(java.lang.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.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.