org.ungoverned.oscar
Interface BundleArchive

All Known Implementing Classes:
DefaultBundleArchive, SystemBundleArchive

public interface BundleArchive

This interface represents an individual cached bundle in the bundle cache. Oscar uses this interface to access all information about the associated bundle's cached information. Classes that implement this interface will be related to a specific implementation of the BundleCache interface.

See Also:
BundleCache

Method Summary
 java.lang.String findLibrary(int revision, java.lang.String libName)
           Returns the absolute file path for the specified native library of the specified revision of the bundle associated with this archive.
 BundleActivator getActivator(java.lang.ClassLoader loader)
           Returns the persistent bundle activator of the bundle associated with this archive; this is a non-standard OSGi method that is only called when Oscar is running in non-strict OSGi mode.
 java.lang.String[] getClassPath(int revision)
           Returns an array of Strings that represent the class path of the specified revision of the bundle associated with this archive.
 java.io.File getDataFile(java.lang.String fileName)
           Returns an appropriate data file for the bundle associated with the archive using the supplied file name.
 long getId()
           Returns the identifier of the bundle associated with this archive.
 java.lang.String getLocation()
           Returns the location string of the bundle associated with this archive.
 java.util.Map getManifestHeader(int revision)
           Returns the main attributes of the JAR file manifest header of the specified revision of the bundle associated with this archive.
 int getPersistentState()
           Returns the persistent state of the bundle associated with the archive; this value will be either Bundle.INSTALLED or Bundle.ACTIVE.
 int getRevisionCount()
           Returns the number of revisions of the bundle associated with the archive.
 int getStartLevel()
           Returns the start level of the bundle associated with this archive.
 void setActivator(java.lang.Object obj)
           Sets the persistent bundle activator of the bundle associated with this archive; this is a non-standard OSGi method that is only called when Oscar is running in non-strict OSGi mode.
 void setPersistentState(int state)
           Sets the persistent state of the bundle associated with this archive; this value will be either Bundle.INSTALLED or Bundle.ACTIVE.
 void setStartLevel(int level)
           Sets the start level of the bundle associated with this archive.
 

Method Detail

getId

public long getId()

Returns the identifier of the bundle associated with this archive.

Returns:
the identifier of the bundle associated with this archive.

getLocation

public java.lang.String getLocation()
                             throws java.lang.Exception

Returns the location string of the bundle associated with this archive.

Returns:
the location string of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

getPersistentState

public int getPersistentState()
                       throws java.lang.Exception

Returns the persistent state of the bundle associated with the archive; this value will be either Bundle.INSTALLED or Bundle.ACTIVE.

Returns:
the persistent state of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

setPersistentState

public void setPersistentState(int state)
                        throws java.lang.Exception

Sets the persistent state of the bundle associated with this archive; this value will be either Bundle.INSTALLED or Bundle.ACTIVE.

Parameters:
state - the new bundle state to write to the archive.
Throws:
java.lang.Exception - if any error occurs.

getStartLevel

public int getStartLevel()
                  throws java.lang.Exception

Returns the start level of the bundle associated with this archive.

Returns:
the start level of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

setStartLevel

public void setStartLevel(int level)
                   throws java.lang.Exception

Sets the start level of the bundle associated with this archive.

Parameters:
level - the new bundle start level to write to the archive.
Throws:
java.lang.Exception - if any error occurs.

getDataFile

public java.io.File getDataFile(java.lang.String fileName)
                         throws java.lang.Exception

Returns an appropriate data file for the bundle associated with the archive using the supplied file name.

Returns:
a File corresponding to the requested data file for the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

getActivator

public BundleActivator getActivator(java.lang.ClassLoader loader)
                             throws java.lang.Exception

Returns the persistent bundle activator of the bundle associated with this archive; this is a non-standard OSGi method that is only called when Oscar is running in non-strict OSGi mode.

Parameters:
loader - the class loader to use when trying to instantiate the bundle activator.
Returns:
the persistent bundle activator of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

setActivator

public void setActivator(java.lang.Object obj)
                  throws java.lang.Exception

Sets the persistent bundle activator of the bundle associated with this archive; this is a non-standard OSGi method that is only called when Oscar is running in non-strict OSGi mode.

Parameters:
obj - the new persistent bundle activator to write to the archive.
Throws:
java.lang.Exception - if any error occurs.

getRevisionCount

public int getRevisionCount()
                     throws java.lang.Exception

Returns the number of revisions of the bundle associated with the archive. When a bundle is updated, the previous version of the bundle is maintained along with the new revision until old revisions are purged. The revision count reflects how many revisions of the bundle are currently available in the cache.

Returns:
the number of revisions of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

getManifestHeader

public java.util.Map getManifestHeader(int revision)
                                throws java.lang.Exception

Returns the main attributes of the JAR file manifest header of the specified revision of the bundle associated with this archive. The returned map should be case insensitive.

Parameters:
revision - the specified revision.
Returns:
the case-insensitive JAR file manifest header of the specified revision of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

getClassPath

public java.lang.String[] getClassPath(int revision)
                                throws java.lang.Exception

Returns an array of Strings that represent the class path of the specified revision of the bundle associated with this archive. Currently, these values are restricted to absolute paths in the file system, but this may be lifted in the future (perhaps they should be ResourceSources from the Module Loader.

Parameters:
revision - the specified revision.
Returns:
a String array of the absolute path names that comprise the class path of the specified revision of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.

findLibrary

public java.lang.String findLibrary(int revision,
                                    java.lang.String libName)
                             throws java.lang.Exception

Returns the absolute file path for the specified native library of the specified revision of the bundle associated with this archive.

Parameters:
revision - the specified revision.
libName - the name of the library.
Returns:
a String that contains the absolute path name to the requested native library of the specified revision of the bundle associated with this archive.
Throws:
java.lang.Exception - if any error occurs.