public interface RuntimeContext
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)
Modifier and Type | Method and Description |
---|---|
RegistrationInfo |
deploy(StreamRef ref)
Same as
deploy(URL) but using a StreamRef as argument. |
RegistrationInfo |
deploy(String location)
Deploys the component whose XML descriptor is at the given location.
|
RegistrationInfo |
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 current runtime service.
|
boolean |
isDeployed(StreamRef ref)
Checks whether the component XML file given by the StreamRef argument was
deployed.
|
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 deployed.
|
Class<?> |
loadClass(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(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.
|
RuntimeService getRuntime()
org.osgi.framework.Bundle getBundle()
Class<?> loadClass(String className) throws ClassNotFoundException
className
- the class nameClassNotFoundException
- if no such class were foundClassLoader.loadClass(String)
URL getResource(String name)
name
- the resource nameClassLoader.getResource(String)
URL getLocalResource(String name)
Only the current bundle should be searched for the resource.
name
- the local resource nameClassLoader.getResource(String)
RegistrationInfo deploy(URL url) throws Exception
Do nothing if component is already deployed.
Returns the registration info of the new deployed component or null if the component was not deployed.
url
- the url of the XML descriptorException
- if any error occursRegistrationInfo deploy(StreamRef ref) throws Exception
deploy(URL)
but using a StreamRef
as argument.ref
- Exception
void undeploy(URL url) throws Exception
Do nothing if no component was registered for the given URL.
url
- the URL of the XML descriptorException
- if any error occursvoid undeploy(StreamRef ref) throws Exception
undeploy(URL)
but using a StreamRef
as stream
reference.ref
- Exception
boolean isDeployed(URL url)
url
- the URL to checkboolean isDeployed(StreamRef ref)
ref
- RegistrationInfo deploy(String location) throws Exception
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.
location
- the locationException
void undeploy(String location) throws Exception
If the component was not deployed do nothing.
location
- the location of the component to undeployException
- if any error occursboolean isDeployed(String location)
location
- the component location to checkvoid destroy()
Copyright © 2011 Nuxeo SA. All Rights Reserved.