org.apache.felix.fileinstall.internal
Class Util

java.lang.Object
  extended by org.apache.felix.fileinstall.internal.Util

public class Util
extends java.lang.Object


Constructor Summary
Util()
           
 
Method Summary
static int getGlobalLogLevel(org.osgi.framework.BundleContext context)
          Returns the log level as defined in the BundleContext or System properties.
static void jarDir(java.io.File directory, java.io.File zipName)
          Jar up a directory
static void jarDir(java.io.File directory, java.io.OutputStream os)
           
static long loadChecksum(org.osgi.framework.Bundle b, org.osgi.framework.BundleContext bc)
          Returns the stored checksum of the bundle.
static void log(org.osgi.framework.BundleContext context, int logLevel, int msgLevel, java.lang.String message, java.lang.Throwable e)
          Log a message and optional throwable.
static void storeChecksum(org.osgi.framework.Bundle b, long checksum, org.osgi.framework.BundleContext bc)
          Stores the checksum into a bundle data file.
static void zipDir(java.io.File directory, java.util.zip.ZipOutputStream zos, java.lang.String path, java.util.Set exclusions)
          Zip up a directory path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

getGlobalLogLevel

public static int getGlobalLogLevel(org.osgi.framework.BundleContext context)
Returns the log level as defined in the BundleContext or System properties.

Parameters:
context - BundleContext of the FileInstall bundle.
Returns:
the global log level, or Logger#LOG_ERROR.

log

public static void log(org.osgi.framework.BundleContext context,
                       int logLevel,
                       int msgLevel,
                       java.lang.String message,
                       java.lang.Throwable e)
Log a message and optional throwable. If there is a log service we use it, otherwise we log to the console

Parameters:
message - The message to log
e - The throwable to log

jarDir

public static void jarDir(java.io.File directory,
                          java.io.File zipName)
                   throws java.io.IOException
Jar up a directory

Parameters:
directory -
zipName -
Throws:
java.io.IOException

jarDir

public static void jarDir(java.io.File directory,
                          java.io.OutputStream os)
                   throws java.io.IOException
Throws:
java.io.IOException

zipDir

public static void zipDir(java.io.File directory,
                          java.util.zip.ZipOutputStream zos,
                          java.lang.String path,
                          java.util.Set exclusions)
                   throws java.io.IOException
Zip up a directory path

Parameters:
directory -
zos -
path -
exclusions -
Throws:
java.io.IOException

storeChecksum

public static void storeChecksum(org.osgi.framework.Bundle b,
                                 long checksum,
                                 org.osgi.framework.BundleContext bc)
Stores the checksum into a bundle data file.

Parameters:
b - The bundle whose checksum must be stored
checksum - the lastModified date to be stored in bc
bc - the FileInstall's bundle context where to store the checksum.

loadChecksum

public static long loadChecksum(org.osgi.framework.Bundle b,
                                org.osgi.framework.BundleContext bc)
Returns the stored checksum of the bundle.

Parameters:
b - the bundle whose checksum must be returned
bc - the FileInstall's bundle context.
Returns:
the stored checksum of the bundle


Copyright © 2006-2012 The Apache Software Foundation. All Rights Reserved.