org.eclipse.osgi.internal.signedcontent
Class SignedBundleHook

java.lang.Object
  extended by org.eclipse.osgi.internal.signedcontent.SignedBundleHook
All Implemented Interfaces:
HookConfigurator, AdaptorHook, BundleFileWrapperFactoryHook, SignedContentFactory

public class SignedBundleHook
extends java.lang.Object
implements AdaptorHook, BundleFileWrapperFactoryHook, HookConfigurator, SignedContentFactory

Implements signed bundle hook support for the framework


Constructor Summary
SignedBundleHook()
           
 
Method Summary
 void addHooks(HookRegistry hookRegistry)
          Adds hooks to the specified hook registry.
 void addProperties(java.util.Properties properties)
          Gets called by the adaptor during FrameworkAdaptor.getProperties().
 FrameworkLog createFrameworkLog()
          Gets called by the adaptor during FrameworkAdaptor.getFrameworkLog().
 void frameworkStart(BundleContext context)
          Gets called by the adaptor during FrameworkAdaptor.frameworkStart(BundleContext).
 void frameworkStop(BundleContext context)
          Gets called by the adaptor during FrameworkAdaptor.frameworkStop(BundleContext).
 void frameworkStopping(BundleContext context)
          Gets called by the adaptor during FrameworkAdaptor.frameworkStopping(BundleContext).
 SignedContent getSignedContent(Bundle bundle)
          Returns a SignedContent object for the specified bundle.
 SignedContent getSignedContent(java.io.File content)
          Returns a SignedContent object for the specified content of a repository.
 void handleRuntimeError(java.lang.Throwable error)
          Gets called by the adaptor during FrameworkAdaptor.handleRuntimeError(Throwable).
 void initialize(BaseAdaptor adaptor)
          Gets called by the adaptor during FrameworkAdaptor.initialize(EventPublisher).
static void log(java.lang.String msg, int severity, java.lang.Throwable t)
           
 java.net.URLConnection mapLocationToURLConnection(java.lang.String location)
          Gets called by the adaptor during FrameworkAdaptor.mapLocationToURLConnection(String).
 BundleFile wrapBundleFile(BundleFile bundleFile, java.lang.Object content, BaseData data, boolean base)
          Wraps a bundle file for the given content and base data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignedBundleHook

public SignedBundleHook()
Method Detail

initialize

public void initialize(BaseAdaptor adaptor)
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.initialize(EventPublisher). This method allows an adaptor hook to save the adaptor object for later.

Specified by:
initialize in interface AdaptorHook
Parameters:
adaptor - the adaptor object associated with this AdaptorHook.

frameworkStart

public void frameworkStart(BundleContext context)
                    throws BundleException
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.frameworkStart(BundleContext). This method allows an adaptor hook to execute code when the framework is starting (e.g. to register services).

Specified by:
frameworkStart in interface AdaptorHook
Parameters:
context - the system bundle context
Throws:
BundleException

frameworkStop

public void frameworkStop(BundleContext context)
                   throws BundleException
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.frameworkStop(BundleContext). This method allows an adaptor hook to execute code when the framework is stopped (e.g. to unregister services).

Specified by:
frameworkStop in interface AdaptorHook
Parameters:
context - the system bundle context
Throws:
BundleException

frameworkStopping

public void frameworkStopping(BundleContext context)
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.frameworkStopping(BundleContext). This method allows an adaptor hook to execute code when the framework is about to start the shutdown process.

Specified by:
frameworkStopping in interface AdaptorHook
Parameters:
context - the system bundle context

addProperties

public void addProperties(java.util.Properties properties)
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.getProperties(). This method allows an adaptor hook to add property values to the adaptor properties object.

Specified by:
addProperties in interface AdaptorHook
Parameters:
properties - the adaptor properties object.

mapLocationToURLConnection

public java.net.URLConnection mapLocationToURLConnection(java.lang.String location)
                                                  throws java.io.IOException
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.mapLocationToURLConnection(String). The adaptor will call this method for each configured adaptor hook until one adaptor hook returns a non-null value. If no adaptor hook returns a non-null value then the adaptor will perform the default behavior.

Specified by:
mapLocationToURLConnection in interface AdaptorHook
Parameters:
location - a bundle location string to be converted to a URLConnection
Returns:
the URLConnection converted from the bundle location or null.
Throws:
java.io.IOException

handleRuntimeError

public void handleRuntimeError(java.lang.Throwable error)
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.handleRuntimeError(Throwable). The adaptor will call this method for each configured adaptor hook.

Specified by:
handleRuntimeError in interface AdaptorHook
Parameters:
error - the unexpected error that occured.

createFrameworkLog

public FrameworkLog createFrameworkLog()
Description copied from interface: AdaptorHook
Gets called by the adaptor during FrameworkAdaptor.getFrameworkLog(). The adaptor will call this method for each configured adaptor hook until one adaptor hook returns a non-null value. If no adaptor hook returns a non-null value then the adaptor will return null.

Specified by:
createFrameworkLog in interface AdaptorHook
Returns:
a FrameworkLog object or null.

wrapBundleFile

public BundleFile wrapBundleFile(BundleFile bundleFile,
                                 java.lang.Object content,
                                 BaseData data,
                                 boolean base)
Description copied from interface: BundleFileWrapperFactoryHook
Wraps a bundle file for the given content and base data. If the specified bundle file should not be wrapped then null is returned

Specified by:
wrapBundleFile in interface BundleFileWrapperFactoryHook
Parameters:
bundleFile - the bundle file to be wrapped
content - The object which contains the content of a bundle file.
data - The base data associated with the content
base - true if the content is for the base bundle (not an inner jar, directory etc.)
Returns:
a wrapped bundle file for the specified content, or null if the bundle content is not wrapped.

addHooks

public void addHooks(HookRegistry hookRegistry)
Description copied from interface: HookConfigurator
Adds hooks to the specified hook registry.

Specified by:
addHooks in interface HookConfigurator
Parameters:
hookRegistry - the hook registry used to add hooks

getSignedContent

public SignedContent getSignedContent(java.io.File content)
                               throws java.io.IOException,
                                      java.security.InvalidKeyException,
                                      java.security.SignatureException,
                                      java.security.cert.CertificateException,
                                      java.security.NoSuchAlgorithmException,
                                      java.security.NoSuchProviderException
Description copied from interface: SignedContentFactory
Returns a SignedContent object for the specified content of a repository.

Specified by:
getSignedContent in interface SignedContentFactory
Parameters:
content - the content of the repository
Returns:
signed content for the specified repository
Throws:
java.io.IOException - if an IO exception occurs while reading the repository
java.security.InvalidKeyException - if there is a problem with one of the certificate keys of the signed content
java.security.SignatureException - if there is a problem with one of the signatures of the signed content
java.security.cert.CertificateException - if there is a problem with one of the certificates of the signed content
java.security.NoSuchAlgorithmException - if the cryptographic algorithm is not available for the signed content
java.security.NoSuchProviderException - if there's no security provider for the signed content

getSignedContent

public SignedContent getSignedContent(Bundle bundle)
                               throws java.io.IOException,
                                      java.security.InvalidKeyException,
                                      java.security.SignatureException,
                                      java.security.cert.CertificateException,
                                      java.security.NoSuchAlgorithmException,
                                      java.security.NoSuchProviderException,
                                      java.lang.IllegalArgumentException
Description copied from interface: SignedContentFactory
Returns a SignedContent object for the specified bundle.

Specified by:
getSignedContent in interface SignedContentFactory
Parameters:
bundle - the bundle to get a signed content for.
Returns:
signed content for the specified bundle.
Throws:
java.io.IOException - if an IO exception occurs while reading the bundle content
java.security.InvalidKeyException - if there is a problem with one of the certificate keys of the signed content
java.security.SignatureException - if there is a problem with one of the signatures of the signed content
java.security.cert.CertificateException - if there is a problem with one of the certificates of the signed content
java.security.NoSuchAlgorithmException - if the cryptographic algorithm is not available for the signed content
java.security.NoSuchProviderException - if there's no security provider for the signed content
java.lang.IllegalArgumentException

log

public static void log(java.lang.String msg,
                       int severity,
                       java.lang.Throwable t)


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