public class BaseData extends Object implements BundleData
BaseAdaptor
,
BundleData
,
StorageHook
,
ClassLoadingHook
Modifier and Type | Field and Description |
---|---|
protected BundleFile |
bundleFile |
protected String |
fileName |
protected Collection<String> |
loadedNativeCode |
protected Dictionary<String,String> |
manifest |
TYPE_BOOTCLASSPATH_EXTENSION, TYPE_COMPOSITEBUNDLE, TYPE_EXTCLASSPATH_EXTENSION, TYPE_FRAGMENT, TYPE_FRAMEWORK_EXTENSION, TYPE_SINGLETON, TYPE_SURROGATEBUNDLE
Constructor and Description |
---|
BaseData(long id,
BaseAdaptor adaptor)
Constructs a new BaseData with the specified id for the specified adaptor
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close all resources for this BundleData
|
BundleClassLoader |
createClassLoader(ClassLoaderDelegate delegate,
BundleProtectionDomain domain,
String[] bundleclasspath)
This method calls all the configured class loading hooks
ClassLoadingHook.createClassLoader(ClassLoader, ClassLoaderDelegate, BundleProtectionDomain, BaseData, String[])
methods until on returns a non-null value. |
String |
findLibrary(String libname)
This method calls each configured classloading hook
ClassLoadingHook.findLibrary(BaseData, String) method
until the first one returns a non-null value. |
Enumeration<URL> |
findLocalResources(String path)
Finds local resources by searching the class path of this bundle data.
|
String |
getActivator()
Returns the Bundle-Activator for this BundleData as specified in
the bundle manifest file.
|
BaseAdaptor |
getAdaptor()
Returns the adaptor for this BaseData
|
Bundle |
getBundle()
Returns the bundle object of this BaseData
|
BundleFile |
getBundleFile()
Returns the BundleFile for this BaseData.
|
BundleFile |
getBundleFile(Object content,
boolean base) |
long |
getBundleID()
Get the BundleData bundle ID.
|
String[] |
getClassPath()
Returns the Bundle-ClassPath for this BundleData as specified in
the bundle manifest file.
|
String |
getClassPathString() |
File |
getDataFile(String path)
Return the bundle data directory.
|
String |
getDynamicImports()
Returns the DynamicImport-Package for this BundleData as
specified in the bundle manifest file.
|
URL |
getEntry(String path)
Gets a
URL to the bundle entry specified by path. |
Enumeration<String> |
getEntryPaths(String path)
Gets all of the bundle entries that exist under the specified path.
|
String |
getExecutionEnvironment()
Returns the Bundle-RequiredExecutionEnvironment for this BundleData as
specified in the bundle manifest file.
|
File |
getExtractFile(String path)
Gets called by BundleFile during
BundleFile.getFile(String, boolean) . |
long |
getLastModified()
Get the last time this BundleData was modified.
|
String |
getLocation()
Get the BundleData Location.
|
Dictionary<String,String> |
getManifest()
Return the Dictionary of manifest headers for the BundleData.
|
int |
getStartLevel()
Returns the start level metadata for this BundleData.
|
int |
getStatus()
Returns the status metadata for this BundleData.
|
StorageHook |
getStorageHook(String key)
Returns the storage hook which is keyed by the specified key
|
StorageHook[] |
getStorageHooks()
Returns all the storage hooks associated with this BaseData
|
String |
getSymbolicName()
Returns the Bundle-SymbolicName for this BundleData as specified in the bundle
manifest file.
|
int |
getType()
Returns the type of bundle this BundleData is for.
|
Version |
getVersion()
Returns the Bundle-Version for this BundleData as specified in the bundle
manifest file.
|
void |
installNativeCode(String[] nativepaths)
Installs the native code paths for this BundleData.
|
boolean |
isDirty()
Returns true if this bundledata is dirty
|
void |
open()
Open the BundleData.
|
void |
save()
Persistently stores all the metadata for this BundleData
|
void |
setActivator(String activator)
Sets the activator of this BaseData
|
void |
setBundle(Bundle bundle)
Sets the Bundle object for this BundleData.
|
void |
setBundleFile(Object content,
BundleFile bundleFile) |
void |
setClassPathString(String classpath) |
void |
setDirty(boolean dirty)
Sets the dirty flag for this BaseData
|
void |
setDynamicImports(String dynamicImports)
Sets the dynamic imports of this BaseData
|
void |
setExecutionEnvironment(String executionEnvironment)
Sets the execution environment of this BaseData
|
void |
setFileName(String fileName)
This is only used to support PDE source lookup.
|
void |
setLastModified(long lastModified)
Sets the last modified time stamp of this bundledata
|
void |
setLocation(String location)
Sets the location of this bundledata
|
void |
setStartLevel(int value)
This method calls each configured storage hook
StorageHook.forgetStartLevelChange(int) method. |
void |
setStatus(int value)
This method calls each configured storage hook
StorageHook.forgetStatusChange(int) method. |
void |
setStorageHooks(StorageHook[] storageHooks)
Sets the instance storage hooks for this base data.
|
void |
setSymbolicName(String symbolicName)
Sets the symbolic name of this BaseData
|
void |
setType(int type)
Sets the type of this BaseData
|
void |
setVersion(Version version)
Sets the version of this BaseData
|
String |
toString()
Return a string representation of the bundle that can be used in debug messages.
|
protected BundleFile bundleFile
protected Dictionary<String,String> manifest
protected String fileName
protected Collection<String> loadedNativeCode
public BaseData(long id, BaseAdaptor adaptor)
id
- the id of the BaseDataadaptor
- the adaptor of the BaseDatapublic BundleClassLoader createClassLoader(ClassLoaderDelegate delegate, BundleProtectionDomain domain, String[] bundleclasspath)
ClassLoadingHook.createClassLoader(ClassLoader, ClassLoaderDelegate, BundleProtectionDomain, BaseData, String[])
methods until on returns a non-null value. If none of the class loading hooks returns a non-null value
then the default classloader implementation is used.createClassLoader
in interface BundleData
delegate
- The ClassLoaderDelegate
to delegate to.domain
- The BundleProtectionDomain
to use when defining a class.bundleclasspath
- An array of bundle classpaths to use to create this
classloader. This is specified by the Bundle-ClassPath manifest entry.BundleData.createClassLoader(ClassLoaderDelegate, BundleProtectionDomain, String[])
public final URL getEntry(String path)
BundleData
URL
to the bundle entry specified by path.
This method must not use the BundleClassLoader to find the
bundle entry since the ClassLoader will delegate to find the resource.getEntry
in interface BundleData
path
- The bundle entry path.Bundle.getEntry(String)
public final Enumeration<String> getEntryPaths(String path)
BundleData
getEntryPaths("/META-INF")
This will return all entries from the /META-INF directory of the bundle.
getEntryPaths
in interface BundleData
path
- The path to a directory in the bundle.Bundle.getEntryPaths(String path)
public String findLibrary(String libname)
ClassLoadingHook.findLibrary(BaseData, String)
method
until the first one returns a non-null value.findLibrary
in interface BundleData
libname
- The name of the library to find the absolute path to.BundleData.findLibrary(String)
public void installNativeCode(String[] nativepaths) throws BundleException
BundleData
installNativeCode
in interface BundleData
nativepaths
- The array of native code paths to install for
the bundle.BundleException
- If any error occurs during install.public File getDataFile(String path)
BundleData
getDataFile
in interface BundleData
BundleContext.getDataFile(String)
public Dictionary<String,String> getManifest() throws BundleException
BundleData
getManifest
in interface BundleData
BundleException
- if an error occurred while reading the
bundle manifest data.public long getBundleID()
BundleData
getBundleID
in interface BundleData
public final String getLocation()
BundleData
getLocation
in interface BundleData
public final void setLocation(String location)
location
- the location of this bundledatapublic final long getLastModified()
BundleData
getLastModified
in interface BundleData
public final void setLastModified(long lastModified)
lastModified
- the last modified time stamp of this bundledatapublic void close() throws IOException
BundleData
close
in interface BundleData
IOException
- If an error occurs closing.public void open() throws IOException
BundleData
open
in interface BundleData
IOException
- If an error occurs opening.public final void setBundle(Bundle bundle)
BundleData
setBundle
in interface BundleData
bundle
- The Bundle Object for this BundleData.public final Bundle getBundle()
getBundle
in interface BundleReference
public int getStartLevel()
BundleData
getStartLevel
in interface BundleData
public int getStatus()
BundleData
getStatus
in interface BundleData
public void setStartLevel(int value)
StorageHook.forgetStartLevelChange(int)
method.
If one returns true then this bundledata is not marked dirty.setStartLevel
in interface BundleData
value
- the start level metadataBundleData.setStartLevel(int)
public void setStatus(int value)
StorageHook.forgetStatusChange(int)
method.
If one returns true then this bundledata is not marked dirty.setStatus
in interface BundleData
value
- the status metadata.BundleData.setStatus(int)
public void save() throws IOException
BundleData
save
in interface BundleData
IOException
public boolean isDirty()
public void setDirty(boolean dirty)
dirty
- the dirty flagpublic final String getSymbolicName()
BundleData
getSymbolicName
in interface BundleData
public final void setSymbolicName(String symbolicName)
symbolicName
- the symbolic namepublic final Version getVersion()
BundleData
getVersion
in interface BundleData
public final void setVersion(Version version)
version
- the versionpublic final int getType()
BundleData
getType
in interface BundleData
public final void setType(int type)
type
- the typepublic final String[] getClassPath() throws BundleException
BundleData
getClassPath
in interface BundleData
BundleException
public String getClassPathString()
public void setClassPathString(String classpath)
public final String getActivator()
BundleData
getActivator
in interface BundleData
public final void setActivator(String activator)
activator
- the activatorpublic final String getExecutionEnvironment()
BundleData
getExecutionEnvironment
in interface BundleData
public void setExecutionEnvironment(String executionEnvironment)
executionEnvironment
- the execution environmentpublic final String getDynamicImports()
BundleData
getDynamicImports
in interface BundleData
public void setDynamicImports(String dynamicImports)
dynamicImports
- the dynamic importspublic final BaseAdaptor getAdaptor()
public BundleFile getBundleFile() throws IllegalArgumentException
BaseAdaptor.createBundleFile(Object, BaseData)
method is called.IllegalArgumentException
public BundleFile getBundleFile(Object content, boolean base)
public void setBundleFile(Object content, BundleFile bundleFile)
public StorageHook getStorageHook(String key)
key
- the key of the storage hook to getpublic void setStorageHooks(StorageHook[] storageHooks)
storageHooks
- the storage hook to addpublic StorageHook[] getStorageHooks()
public File getExtractFile(String path)
BundleFile.getFile(String, boolean)
. This method
will allocate a File object where content of the specified path may be
stored for the current generation of the base data. The returned File object may
not exist if the content has not previously be stored.path
- the path to the content to extract from the base datapublic void setFileName(String fileName)
fileName
- an absolute path string to the base bundle file.public String toString()
public Enumeration<URL> findLocalResources(String path)
BundleData
findLocalResources
in interface BundleData
path
- the requested resource name.Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.