public class RemoteContext extends Object implements RuntimeContext
Constructor and Description |
---|
RemoteContext(ServerDescriptor sd,
ComponentName component,
ClassLoader localClassLoader) |
Modifier and Type | Method and Description |
---|---|
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.
|
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
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.
|
public RemoteContext(ServerDescriptor sd, ComponentName component, ClassLoader localClassLoader)
public URL getLocalResource(String name)
RuntimeContext
Only the current bundle should be searched for the resource.
getLocalResource
in interface RuntimeContext
name
- the local resource nameClassLoader.getResource(String)
public URL getResource(String name)
RuntimeContext
getResource
in interface RuntimeContext
name
- the resource nameClassLoader.getResource(String)
public Class<?> loadClass(String className) throws ClassNotFoundException
RuntimeContext
loadClass
in interface RuntimeContext
className
- the class nameClassNotFoundException
- if no such class were foundClassLoader.loadClass(String)
public RuntimeService getRuntime()
RuntimeContext
getRuntime
in interface RuntimeContext
public boolean isDeployed(URL url)
RuntimeContext
isDeployed
in interface RuntimeContext
url
- the URL to checkpublic boolean isDeployed(String location)
RuntimeContext
isDeployed
in interface RuntimeContext
location
- the component location to checkpublic void undeploy(URL url) throws Exception
RuntimeContext
Do nothing if no component was registered for the given URL.
undeploy
in interface RuntimeContext
url
- the URL of the XML descriptorException
- if any error occurspublic void undeploy(String location) throws Exception
RuntimeContext
If the component was not deployed do nothing.
undeploy
in interface RuntimeContext
location
- the location of the component to undeployException
- if any error occurspublic RegistrationInfo deploy(StreamRef ref) throws Exception
RuntimeContext
RuntimeContext.deploy(URL)
but using a StreamRef
as argument.deploy
in interface RuntimeContext
Exception
public void undeploy(StreamRef ref) throws Exception
RuntimeContext
RuntimeContext.undeploy(URL)
but using a StreamRef
as stream
reference.undeploy
in interface RuntimeContext
Exception
public RegistrationInfo deploy(URL url) throws Exception
RuntimeContext
Do 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 RuntimeContext
url
- the url of the XML descriptorException
- if any error occurspublic RegistrationInfo deploy(String location) throws Exception
RuntimeContext
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
RuntimeContext.getLocalResource(String)
.
Returns the registration info of the new deployed component or null if the component was not deployed.
deploy
in interface RuntimeContext
location
- the locationException
public boolean isDeployed(StreamRef ref)
RuntimeContext
isDeployed
in interface RuntimeContext
public void destroy()
RuntimeContext
destroy
in interface RuntimeContext
public org.osgi.framework.Bundle getBundle()
RuntimeContext
getBundle
in interface RuntimeContext
Copyright © 2013 Nuxeo SA. All Rights Reserved.