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) Note that all undeploy
methods are deprectaed! see DefaultRuntimeContext
for more information
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.
|
ComponentName[] |
getComponents()
Get the component names deployed by this context
|
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()
ComponentName[] getComponents()
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 IOException
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 descriptorIOException
RegistrationInfo deploy(StreamRef ref) throws IOException
deploy(URL)
but using a StreamRef
as argument.IOException
void undeploy(URL url) throws IOException
Do nothing if no component was registered for the given URL.
url
- the URL of the XML descriptorIOException
void undeploy(StreamRef ref) throws IOException
undeploy(URL)
but using a StreamRef
as stream reference.IOException
boolean isDeployed(URL url)
url
- the URL to checkboolean isDeployed(StreamRef ref)
RegistrationInfo deploy(String 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.
location
- the locationvoid undeploy(String location)
If the component was not deployed do nothing.
location
- the location of the component to undeployboolean isDeployed(String location)
location
- the component location to checkvoid destroy()
Copyright © 2017 Nuxeo. All rights reserved.