Package org.nuxeo.runtime.osgi
Class OSGiRuntimeContext
- java.lang.Object
-
- org.nuxeo.runtime.model.impl.DefaultRuntimeContext
-
- org.nuxeo.runtime.osgi.OSGiRuntimeContext
-
- All Implemented Interfaces:
RuntimeContext
public class OSGiRuntimeContext extends DefaultRuntimeContext
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected org.osgi.framework.Bundlebundleprotected org.osgi.framework.BundlehostBundleprotected StringhostBundleId-
Fields inherited from class org.nuxeo.runtime.model.impl.DefaultRuntimeContext
components, reader, runtime
-
-
Constructor Summary
Constructors Constructor Description OSGiRuntimeContext(RuntimeService runtime, org.osgi.framework.Bundle bundle)OSGiRuntimeContext(org.osgi.framework.Bundle bundle)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.osgi.framework.BundlegetBundle()Gets the container bundle or null if we are not running in an OSGi environment.org.osgi.framework.BundlegetHostBundle()URLgetLocalResource(String name)Finds a local resource having the given name.URLgetResource(String name)Finds a resource having the given name.Class<?>loadClass(String className)Loads the class given its name.-
Methods inherited from class org.nuxeo.runtime.model.impl.DefaultRuntimeContext
createRegistrationInfo, createRegistrationInfo, deploy, deploy, deploy, destroy, getComponents, getRuntime, isDeployed, isDeployed, isDeployed, setRuntime, undeploy, undeploy, undeploy
-
-
-
-
Field Detail
-
bundle
protected final org.osgi.framework.Bundle bundle
-
hostBundleId
protected String hostBundleId
-
hostBundle
protected org.osgi.framework.Bundle hostBundle
-
-
Constructor Detail
-
OSGiRuntimeContext
public OSGiRuntimeContext(org.osgi.framework.Bundle bundle)
-
OSGiRuntimeContext
public OSGiRuntimeContext(RuntimeService runtime, org.osgi.framework.Bundle bundle)
-
-
Method Detail
-
getBundle
public org.osgi.framework.Bundle getBundle()
Description copied from interface:RuntimeContextGets the container bundle or null if we are not running in an OSGi environment.- Specified by:
getBundlein interfaceRuntimeContext- Overrides:
getBundlein classDefaultRuntimeContext
-
getResource
public URL getResource(String name)
Description copied from interface:RuntimeContextFinds a resource having the given name.- Specified by:
getResourcein interfaceRuntimeContext- Overrides:
getResourcein classDefaultRuntimeContext- 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
public URL getLocalResource(String name)
Description copied from interface:RuntimeContextFinds a local resource having the given name.Only the current bundle should be searched for the resource.
- Specified by:
getLocalResourcein interfaceRuntimeContext- Overrides:
getLocalResourcein classDefaultRuntimeContext- 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)
-
loadClass
public Class<?> loadClass(String className) throws ClassNotFoundException
Description copied from interface:RuntimeContextLoads the class given its name.- Specified by:
loadClassin interfaceRuntimeContext- Overrides:
loadClassin classDefaultRuntimeContext- Parameters:
className- the class name- Returns:
- the class object
- Throws:
ClassNotFoundException- if no such class were found- See Also:
ClassLoader.loadClass(String)
-
getHostBundle
public org.osgi.framework.Bundle getHostBundle()
-
-