public class DefaultRuntimeContext extends Object implements RuntimeContext
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,ComponentName> |
deployedFiles |
protected ComponentDescriptorReader |
reader |
protected RuntimeService |
runtime |
| Constructor and Description |
|---|
DefaultRuntimeContext() |
DefaultRuntimeContext(RuntimeService runtime) |
| Modifier and Type | Method and Description |
|---|---|
RegistrationInfoImpl |
createRegistrationInfo(InputStream in) |
RegistrationInfoImpl |
createRegistrationInfo(StreamRef ref) |
RegistrationInfo |
deploy(StreamRef ref)
Same as
RuntimeContext.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.
|
Map<String,ComponentName> |
getDeployedFiles() |
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 |
setRuntime(RuntimeService runtime) |
void |
undeploy(StreamRef ref)
Same as
RuntimeContext.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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseprotected RuntimeService runtime
protected final ComponentDescriptorReader reader
protected final Map<String,ComponentName> deployedFiles
public DefaultRuntimeContext()
public DefaultRuntimeContext(RuntimeService runtime)
public void setRuntime(RuntimeService runtime)
public RuntimeService getRuntime()
RuntimeContextgetRuntime in interface RuntimeContextpublic Map<String,ComponentName> getDeployedFiles()
public URL getResource(String name)
RuntimeContextgetResource in interface RuntimeContextname - the resource nameClassLoader.getResource(String)public URL getLocalResource(String name)
RuntimeContextOnly the current bundle should be searched for the resource.
getLocalResource in interface RuntimeContextname - the local resource nameClassLoader.getResource(String)public Class<?> loadClass(String className) throws ClassNotFoundException
RuntimeContextloadClass in interface RuntimeContextclassName - the class nameClassNotFoundException - if no such class were foundClassLoader.loadClass(String)public RegistrationInfo deploy(URL url) throws IOException
RuntimeContextDo nothing if component is already deployed.
Returns the registration info of the new deployed component or null if the component was not deployed.
deploy in interface RuntimeContexturl - the url of the XML descriptorIOExceptionpublic RegistrationInfo deploy(StreamRef ref) throws IOException
RuntimeContextRuntimeContext.deploy(URL) but using a StreamRef as argument.deploy in interface RuntimeContextIOExceptionpublic void undeploy(URL url)
RuntimeContextDo nothing if no component was registered for the given URL.
undeploy in interface RuntimeContexturl - the URL of the XML descriptorpublic void undeploy(StreamRef ref)
RuntimeContextRuntimeContext.undeploy(URL) but using a StreamRef as stream reference.undeploy in interface RuntimeContextpublic boolean isDeployed(URL url)
RuntimeContextisDeployed in interface RuntimeContexturl - the URL to checkpublic boolean isDeployed(StreamRef ref)
RuntimeContextisDeployed in interface RuntimeContextpublic RegistrationInfo deploy(String location)
RuntimeContextIf 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 RuntimeContext.getLocalResource(String).
Returns the registration info of the new deployed component or null if the component was not deployed.
deploy in interface RuntimeContextlocation - the locationpublic void undeploy(String location)
RuntimeContextIf the component was not deployed do nothing.
undeploy in interface RuntimeContextlocation - the location of the component to undeploypublic boolean isDeployed(String location)
RuntimeContextisDeployed in interface RuntimeContextlocation - the component location to checkpublic void destroy()
RuntimeContextdestroy in interface RuntimeContextpublic org.osgi.framework.Bundle getBundle()
RuntimeContextgetBundle in interface RuntimeContextpublic RegistrationInfoImpl createRegistrationInfo(StreamRef ref) throws IOException
IOExceptionpublic RegistrationInfoImpl createRegistrationInfo(InputStream in) throws IOException
IOExceptionCopyright © 2016 Nuxeo SA. All rights reserved.