org.eclipse.osgi.internal.baseadaptor
Class BaseStorage

java.lang.Object
  extended by org.eclipse.osgi.internal.baseadaptor.BaseStorage
All Implemented Interfaces:
java.util.EventListener, BundleListener, SynchronousBundleListener

public class BaseStorage
extends java.lang.Object
implements SynchronousBundleListener


Field Summary
static byte BUNDLEDATA_VERSION
          The current bundle data version
static java.lang.String DELETE_FLAG
          the file name for the delete flag.
static byte EXTENSION_INITIALIZE
          flag to indicate a framework extension is being intialized
static byte EXTENSION_INSTALLED
          flag to indicate a framework extension is being installed
static byte EXTENSION_UNINSTALLED
          flag to indicate a framework extension is being uninstalled
static byte EXTENSION_UPDATED
          flag to indicate a framework extension is being updated
static int TYPE_DIRECTORYBUNDLE
          The BundleData is for a bundle exploded in a directory
static int TYPE_FILEBUNDLE
          The BundleData is for a bundle contained in a file (typically jar)
 
Method Summary
 void addProperties(java.util.Properties properties)
           
 void bundleChanged(BundleEvent event)
          Receives notification that a bundle has had a lifecycle change.
 void compact()
           
 java.lang.String copyToTempLibrary(BaseData data, java.lang.String absolutePath)
           
protected  BaseData createBaseData(long id, java.lang.String location)
           
 BundleFile createBundleFile(java.lang.Object content, BaseData data)
           
 void frameworkStart(BundleContext fwContext)
           
 void frameworkStop(BundleContext fwContext)
           
 void frameworkStopping(BundleContext fwContext)
           
protected  java.lang.Object getBundleContent(BaseData bundledata)
           
 java.io.File getBundleStoreRoot()
           
protected  java.lang.String[] getConfiguredExtensions()
          Returns a list of configured extensions
 java.io.File getDataFile(BaseData data, java.lang.String path)
           
protected  java.io.File[] getExtensionFiles(BaseData bundleData)
          Returns a list of classpath files for an extension bundle
 java.io.File getExtractFile(BaseData data, java.lang.String path)
           
 long getFreeSpace()
           
 int getInitialBundleStartLevel()
           
 BaseData[] getInstalledBundles()
           
 java.lang.String getInstallPath()
           
 long getNextBundleId()
           
 PermissionStorage getPermissionStorage()
           
 StateManager getStateManager()
           
protected  StorageManager initFileManager(java.io.File baseDir, java.lang.String lockMode, boolean readOnly)
           
 void initialize(BaseAdaptor initAdaptor)
           
 BundleOperation installBundle(java.lang.String location, java.net.URLConnection source)
           
 void installNativeCode(BaseData data, java.lang.String[] nativepaths)
           
 boolean isReadOnly()
           
protected  BaseData loadBaseData(long id, java.io.DataInputStream in)
           
 java.util.Dictionary<java.lang.String,java.lang.String> loadManifest(BaseData data)
           
 java.util.Dictionary<java.lang.String,java.lang.String> loadManifest(BaseData bundleData, boolean firstTime)
           
protected  void processBootExtension(BundleData bundleData, byte type)
          Processes a boot extension bundle
protected  void processExtension(BaseData bundleData, byte type)
          Processes an extension bundle
protected  void processExtExtension(BaseData bundleData, byte type)
           
protected  void processFrameworkExtension(BaseData bundleData, byte type)
          Processes a framework extension bundle
 void save(BaseData data)
           
protected  void saveBaseData(BaseData bundledata, java.io.DataOutputStream out)
           
 void setInitialBundleStartLevel(int value)
           
 BundleOperation uninstallBundle(BaseData data)
           
 BundleOperation updateBundle(BaseData data, java.net.URLConnection source)
           
 void updateState(BaseData bundleData, int type)
          Updates the state mananager with an updated/installed/uninstalled bundle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLEDATA_VERSION

public static final byte BUNDLEDATA_VERSION
The current bundle data version

See Also:
Constant Field Values

EXTENSION_INITIALIZE

public static final byte EXTENSION_INITIALIZE
flag to indicate a framework extension is being intialized

See Also:
Constant Field Values

EXTENSION_INSTALLED

public static final byte EXTENSION_INSTALLED
flag to indicate a framework extension is being installed

See Also:
Constant Field Values

EXTENSION_UNINSTALLED

public static final byte EXTENSION_UNINSTALLED
flag to indicate a framework extension is being uninstalled

See Also:
Constant Field Values

EXTENSION_UPDATED

public static final byte EXTENSION_UPDATED
flag to indicate a framework extension is being updated

See Also:
Constant Field Values

TYPE_DIRECTORYBUNDLE

public static final int TYPE_DIRECTORYBUNDLE
The BundleData is for a bundle exploded in a directory

See Also:
Constant Field Values

TYPE_FILEBUNDLE

public static final int TYPE_FILEBUNDLE
The BundleData is for a bundle contained in a file (typically jar)

See Also:
Constant Field Values

DELETE_FLAG

public static final java.lang.String DELETE_FLAG
the file name for the delete flag. If this file exists in one a directory under the bundle store area then it will be removed during the compact operation.

See Also:
Constant Field Values
Method Detail

initialize

public void initialize(BaseAdaptor initAdaptor)
                throws java.io.IOException
Throws:
java.io.IOException

initFileManager

protected StorageManager initFileManager(java.io.File baseDir,
                                         java.lang.String lockMode,
                                         boolean readOnly)
                                  throws java.io.IOException
Throws:
java.io.IOException

isReadOnly

public boolean isReadOnly()

compact

public void compact()

getFreeSpace

public long getFreeSpace()
                  throws java.io.IOException
Throws:
java.io.IOException

getDataFile

public java.io.File getDataFile(BaseData data,
                                java.lang.String path)

installNativeCode

public void installNativeCode(BaseData data,
                              java.lang.String[] nativepaths)
                       throws BundleException
Throws:
BundleException

loadManifest

public java.util.Dictionary<java.lang.String,java.lang.String> loadManifest(BaseData data)
                                                                     throws BundleException
Throws:
BundleException

loadManifest

public java.util.Dictionary<java.lang.String,java.lang.String> loadManifest(BaseData bundleData,
                                                                            boolean firstTime)
                                                                     throws BundleException
Throws:
BundleException

getExtractFile

public java.io.File getExtractFile(BaseData data,
                                   java.lang.String path)

getInstalledBundles

public BaseData[] getInstalledBundles()

getPermissionStorage

public PermissionStorage getPermissionStorage()

getInitialBundleStartLevel

public int getInitialBundleStartLevel()

setInitialBundleStartLevel

public void setInitialBundleStartLevel(int value)

save

public void save(BaseData data)

installBundle

public BundleOperation installBundle(java.lang.String location,
                                     java.net.URLConnection source)

updateBundle

public BundleOperation updateBundle(BaseData data,
                                    java.net.URLConnection source)

uninstallBundle

public BundleOperation uninstallBundle(BaseData data)

getBundleContent

protected java.lang.Object getBundleContent(BaseData bundledata)

createBundleFile

public BundleFile createBundleFile(java.lang.Object content,
                                   BaseData data)
                            throws java.io.IOException
Throws:
java.io.IOException

getStateManager

public StateManager getStateManager()

frameworkStart

public void frameworkStart(BundleContext fwContext)

frameworkStop

public void frameworkStop(BundleContext fwContext)

frameworkStopping

public void frameworkStopping(BundleContext fwContext)

addProperties

public void addProperties(java.util.Properties properties)

saveBaseData

protected void saveBaseData(BaseData bundledata,
                            java.io.DataOutputStream out)
                     throws java.io.IOException
Throws:
java.io.IOException

loadBaseData

protected BaseData loadBaseData(long id,
                                java.io.DataInputStream in)
                         throws java.io.IOException
Throws:
java.io.IOException

createBaseData

protected BaseData createBaseData(long id,
                                  java.lang.String location)

getInstallPath

public java.lang.String getInstallPath()

processExtension

protected void processExtension(BaseData bundleData,
                                byte type)
                         throws BundleException
Processes an extension bundle

Parameters:
bundleData - the extension bundle data
type - the type of extension bundle
Throws:
BundleException - on any errors or if the extension bundle type is not supported

processFrameworkExtension

protected void processFrameworkExtension(BaseData bundleData,
                                         byte type)
                                  throws BundleException
Processes a framework extension bundle

Parameters:
bundleData - the extension bundle data
type - the type of extension bundle
Throws:
BundleException - on errors or if framework extensions are not supported

processExtExtension

protected void processExtExtension(BaseData bundleData,
                                   byte type)
                            throws BundleException
Throws:
BundleException

getConfiguredExtensions

protected java.lang.String[] getConfiguredExtensions()
Returns a list of configured extensions

Returns:
a list of configured extensions

processBootExtension

protected void processBootExtension(BundleData bundleData,
                                    byte type)
                             throws BundleException
Processes a boot extension bundle

Parameters:
bundleData - the extension bundle data
type - the type of extension bundle
Throws:
BundleException - on errors or if boot extensions are not supported

getBundleStoreRoot

public java.io.File getBundleStoreRoot()

getExtensionFiles

protected java.io.File[] getExtensionFiles(BaseData bundleData)
Returns a list of classpath files for an extension bundle

Parameters:
bundleData - the bundle data for an extension bundle
Returns:
a list of classpath files for an extension bundle

updateState

public void updateState(BaseData bundleData,
                        int type)
                 throws BundleException
Updates the state mananager with an updated/installed/uninstalled bundle

Parameters:
bundleData - the modified bundle
type - the type of modification
Throws:
BundleException

getNextBundleId

public long getNextBundleId()

bundleChanged

public void bundleChanged(BundleEvent event)
Description copied from interface: BundleListener
Receives notification that a bundle has had a lifecycle change.

Specified by:
bundleChanged in interface BundleListener
Parameters:
event - The BundleEvent.

copyToTempLibrary

public java.lang.String copyToTempLibrary(BaseData data,
                                          java.lang.String absolutePath)
                                   throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.