|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knopflerfish.framework.BundleImpl
org.knopflerfish.framework.SystemBundle
public class SystemBundle
Implementation of the System Bundle object.
Bundle
Field Summary |
---|
Fields inherited from class org.knopflerfish.framework.BundleImpl |
---|
bactivator, bundleContext, bundleDir, lastModified |
Fields inherited from interface org.osgi.framework.Bundle |
---|
ACTIVE, INSTALLED, RESOLVED, STARTING, STOPPING, UNINSTALLED |
Method Summary | |
---|---|
java.util.Enumeration |
findEntries(java.lang.String path,
java.lang.String filePattern,
boolean recurse)
Get bundle data. |
java.net.URL |
getEntry(java.lang.String name)
Returns a URL to the specified entry in this bundle. |
java.util.Enumeration |
getEntryPaths(java.lang.String path)
Returns an Enumeration of all the paths ( String objects)
to entries within the bundle whose longest sub-path matches the supplied
path argument. |
java.util.Dictionary |
getHeaders()
Get header data. |
java.util.Dictionary |
getHeaders(java.lang.String locale)
Returns this bundle's Manifest headers and values localized to the specified locale. |
boolean |
hasPermission(java.lang.Object permission)
Determine whether the bundle has the requested permission. |
protected void |
readLocalization(java.lang.String locale,
java.util.Hashtable localization_entries,
java.lang.String baseName)
Reads all localization entries that affects this bundle (including its host/fragments) |
void |
start()
Start this bundle. |
void |
stop()
Stop this bundle. |
void |
stop(int exitcode)
|
void |
uninstall()
Uninstall this bundle. |
void |
update(java.io.InputStream in)
Update this bundle. |
Methods inherited from class org.knopflerfish.framework.BundleImpl |
---|
getBundleContext, getBundleId, getCertificates, getLastModified, getLocation, getRegisteredServices, getResource, getResources, getServicesInUse, getState, getSymbolicName, loadClass, toString, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public boolean hasPermission(java.lang.Object permission)
BundleImpl
hasPermission
in interface Bundle
hasPermission
in class BundleImpl
permission
- The permission to verify.
true
if this bundle has the specified permission
or the permissions possessed by this bundle imply the specified
permission; false
if this bundle does not have the
specified permission or permission
is not an
instanceof
java.security.Permission
.Bundle.hasPermission(java.lang.Object)
public void start() throws BundleException
start
in interface Bundle
start
in class BundleImpl
BundleException
- If this bundle could not be started. This could
be because a code dependency could not be resolved or the
specified BundleActivator
could not be loaded or
threw an exception.Bundle.start()
public void stop() throws BundleException
stop
in interface Bundle
stop
in class BundleImpl
BundleException
- If this bundle's BundleActivator
could not be loaded or threw an exception.Bundle.stop()
public void stop(int exitcode) throws BundleException
BundleException
public void update(java.io.InputStream in) throws BundleException
update
in interface Bundle
update
in class BundleImpl
in
- The InputStream
from which to read the new
bundle.
BundleException
- If the provided stream cannot be read or the
update fails.Bundle.update()
public void uninstall() throws BundleException
uninstall
in interface Bundle
uninstall
in class BundleImpl
BundleException
- If the uninstall failed. This can occur if
another thread is attempting to change the bundle's state and
does not complete in a timely manner.Bundle.uninstall()
public java.util.Dictionary getHeaders()
getHeaders
in interface Bundle
getHeaders
in class BundleImpl
Dictionary
object containing this bundle's
Manifest headers and values.Bundle.getHeaders()
public java.util.Dictionary getHeaders(java.lang.String locale)
Bundle
This method performs the same function as
Bundle.getHeaders()
except the manifest header values are
localized to the specified locale.
If a Manifest header value starts with "%", it must be localized according to the specified locale. If a locale is specified and cannot be found, then the header values must be returned using the default locale. Localizations are searched for in the following order:
bn + "_" + Ls + "_" + Cs + "_" + Vs bn + "_" + Ls + "_" + Cs bn + "_" + Ls bn + "_" + Ld + "_" + Cd + "_" + Vd bn + "_" + Ld + "_" + Cd bn + "_" + Ld bnWhere
bn
is the bundle localization basename, Ls
,
Cs
and Vs
are the specified locale (language,
country, variant) and Ld
, Cd
and Vd
are the default locale (language, country, variant).
If null
is specified as the locale string, the header
values must be localized using the default locale. If the empty string
("") is specified as the locale string, the header values must
not be localized and the raw (unlocalized) header values, including any
leading "%", must be returned.
This method must continue to return Manifest header information while
this bundle is in the UNINSTALLED
state, however the
header values must only be available in the raw and default locale
values.
getHeaders
in interface Bundle
getHeaders
in class BundleImpl
locale
- The locale name into which the header values are to be
localized. If the specified locale is null
then the
locale returned by java.util.Locale.getDefault
is
used. If the specified locale is the empty string, this method
will return the raw (unlocalized) manifest headers including any
leading "%".
Dictionary
object containing this bundle's
Manifest headers and values.Bundle.getHeaders(String locale)
public java.util.Enumeration findEntries(java.lang.String path, java.lang.String filePattern, boolean recurse)
findEntries
in interface Bundle
findEntries
in class BundleImpl
path
- The path name in which to look. A specified path of
"/" indicates the root of the bundle. Path is relative
to the root of the bundle and must not be null.filePattern
- The file name pattern for selecting entries in the
specified path. The pattern is only matched against the last
element of the entry path and it supports substring matching, as
specified in the Filter specification, using the wildcard
character ("*"). If null is specified, this is
equivalent to "*" and matches all files.recurse
- If true
, recurse into subdirectories.
Otherwise only return entries from the given directory.
null
if an entry could not be found or if the
caller does not have the appropriate
AdminPermission[this,RESOURCE]
, and the Java Runtime
Environment supports permissions. The URLs are sorted such that
entries from this bundle are returned first followed by the
entries from attached fragments in ascending bundle id order. If
this bundle is a fragment, then only matching entries in this
fragment are returned.Bundle.findEntries(java.lang.String, java.lang.String, boolean)
public java.net.URL getEntry(java.lang.String name)
Bundle
getEntry
in interface Bundle
getEntry
in class BundleImpl
name
- The name of the entry. See
java.lang.ClassLoader.getResource
for a description
of the format of a resource name.
null
if no entry
could be found or if the caller does not have the appropriate
AdminPermission[this,RESOURCE]
and the Java Runtime
Environment supports permissions.public java.util.Enumeration getEntryPaths(java.lang.String path)
Bundle
String
objects)
to entries within the bundle whose longest sub-path matches the supplied
path argument. The bundle's classloader is not used to search for
entries. Only the contents of the bundle is searched. A specified path of
"/" indicates the root of the bundle.
Returned paths indicating subdirectory paths end with a "/". The returned paths are all relative to the root of the bundle.
getEntryPaths
in interface Bundle
getEntryPaths
in class BundleImpl
path
- The path name for which to return entry paths.
String
objects) or null
if no entry could be found or if
the caller does not have the appropriate
AdminPermission[this,RESOURCE]
and the Java Runtime
Environment supports permissions.protected void readLocalization(java.lang.String locale, java.util.Hashtable localization_entries, java.lang.String baseName)
readLocalization
in class BundleImpl
locale
- locale == "" the bundle.properties will be read
o/w it will read the files as described in the spec.localization_entries
- will append the new entries to this dictionarybaseName
- the basename for localization properties,
null
will choose OSGi default
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |