nl.gx.webmanager.wcb.lifecycle
Class WCBLifecycleUtil

java.lang.Object
  extended by nl.gx.webmanager.wcb.lifecycle.WCBLifecycleUtil

public class WCBLifecycleUtil
extends java.lang.Object


Constructor Summary
WCBLifecycleUtil()
           
 
Method Summary
static void deleteExcludedBundleResources(org.osgi.framework.Bundle bundle, java.lang.String srcFileNamePrefix, java.lang.String destFileNamePrefix, java.lang.String directoryName)
          Deletes all the resources (files and directories) that are in the directory, but not in the resources of the bundle.
static void deleteFileFromDisk(java.io.File file)
          Delete a specified file from disk.
static java.lang.String formatFileName(java.lang.String fileName)
          Formats the specified filename by fixing \ and / file separators and removing the starting file separator
static java.lang.String formatFileName(java.lang.String fileName, java.lang.Boolean cutStartingSeparator)
          Formats the specified filename by fixing \ and / file separators
static java.lang.String formatPath(java.lang.String pathName)
          Ensure that the given pathname is a system path; System specific direcory indicators and ending with File.separator.
static ComponentBundleDefinition getBundleDefinition(org.osgi.framework.Bundle bundle)
          Returns the component bundle definition from the specified bundle.
If the given bundle does not provide any component bundle definition null will be returned.
static java.lang.String substringAfter(java.lang.String str, java.lang.String separator)
          Returns the remainder of the string after the first occurrence of the given separator
static void writeBundleResourcesToFile(java.lang.String[] srcFileNames, java.lang.String jarScrPrefix, java.lang.String destFileNamePrefix, ComponentBundleDefinition bundleDefinition, java.lang.String baseDir)
          deploy the srcFileNames[] to the given destFileNamePrefix tipicaly used for language resources f.e.
static void writeBundleResourcesToFile(java.lang.String srcFileNamePrefix, java.lang.String destFileNamePrefix, java.lang.String baseDirectory, ComponentBundleDefinition bundleDefinition)
           
static void writeComponentBundleResourceToFile(java.lang.String srcFileName, java.lang.String destFileName, java.lang.String destFileNamePrefix, java.lang.String destBaseDirectory, ComponentBundleDefinition bundleDefinition)
          Write component bundle resource to file
static void writeResourceToFile(java.net.URL srcResourceURL, java.lang.String destFileName)
          Stream a resource file named resourceName, which is present in the bundle that is passed on, to the specified location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WCBLifecycleUtil

public WCBLifecycleUtil()
Method Detail

deleteFileFromDisk

public static void deleteFileFromDisk(java.io.File file)
Delete a specified file from disk.

Parameters:
file - File to delete

deleteExcludedBundleResources

public static void deleteExcludedBundleResources(org.osgi.framework.Bundle bundle,
                                                 java.lang.String srcFileNamePrefix,
                                                 java.lang.String destFileNamePrefix,
                                                 java.lang.String directoryName)
Deletes all the resources (files and directories) that are in the directory, but not in the resources of the bundle.

Parameters:
bundle - The bundle that contains the resources to compare with
directoryName - The directory to check for resources
srcFileNamePrefix - The prefix of files in the bundle, like "presentationtype/jsp/"
destFileNamePrefix - The prefix of files in the directory, like "WEB-INF/project/<bundleId>"

writeBundleResourcesToFile

public static void writeBundleResourcesToFile(java.lang.String srcFileNamePrefix,
                                              java.lang.String destFileNamePrefix,
                                              java.lang.String baseDirectory,
                                              ComponentBundleDefinition bundleDefinition)
Parameters:
srcFileNamePrefix -
destFileNamePrefix -
baseDirectory -

writeBundleResourcesToFile

public static void writeBundleResourcesToFile(java.lang.String[] srcFileNames,
                                              java.lang.String jarScrPrefix,
                                              java.lang.String destFileNamePrefix,
                                              ComponentBundleDefinition bundleDefinition,
                                              java.lang.String baseDir)
deploy the srcFileNames[] to the given destFileNamePrefix tipicaly used for language resources f.e. jar file : messages/messages_nl_nl.properties will be deployed as : /WEB-INF/messages/{bundle_id}_nl_nl.properties

Parameters:
srcFileNames - filenames to deply (jar format)
jarScrPrefix - prefix for the srcFileNames location in the jar f.e. messages/
destFileNamePrefix - destenation path can hold bundle specific names

writeComponentBundleResourceToFile

public static void writeComponentBundleResourceToFile(java.lang.String srcFileName,
                                                      java.lang.String destFileName,
                                                      java.lang.String destFileNamePrefix,
                                                      java.lang.String destBaseDirectory,
                                                      ComponentBundleDefinition bundleDefinition)
Write component bundle resource to file

Parameters:
srcFileName -
destFileName -
destFileNamePrefix -
destBaseDirectory -

writeResourceToFile

public static void writeResourceToFile(java.net.URL srcResourceURL,
                                       java.lang.String destFileName)
Stream a resource file named resourceName, which is present in the bundle that is passed on, to the specified location.

Parameters:
srcResourceURL - URL of resource to write
destFileName - Destination filename to write to

substringAfter

public static java.lang.String substringAfter(java.lang.String str,
                                              java.lang.String separator)
Returns the remainder of the string after the first occurrence of the given separator

Parameters:
str - String to evaluate
separator - Separator to split on
Returns:
remainder of the string after the first occurrence of the given separator

formatFileName

public static java.lang.String formatFileName(java.lang.String fileName)
Formats the specified filename by fixing \ and / file separators and removing the starting file separator

Parameters:
fileName - Filename to format is removed from the filename
Returns:
Formatted filename

formatFileName

public static java.lang.String formatFileName(java.lang.String fileName,
                                              java.lang.Boolean cutStartingSeparator)
Formats the specified filename by fixing \ and / file separators

Parameters:
fileName - Filename to format
cutStartingSeparator - if true the starting separator is removed from the filename
Returns:
Formatted filename

formatPath

public static java.lang.String formatPath(java.lang.String pathName)
Ensure that the given pathname is a system path; System specific direcory indicators and ending with File.separator.

Parameters:
pathName -
Returns:
pathName as a path

getBundleDefinition

public static ComponentBundleDefinition getBundleDefinition(org.osgi.framework.Bundle bundle)
Returns the component bundle definition from the specified bundle.
If the given bundle does not provide any component bundle definition null will be returned.

Parameters:
bundle - Bundle to retrieve the component bundle definition for.
Returns:
ComponentBundleDefinition for the specified bundle or null if the given bundle does not provide any.


Copyright © 2007-2011 GX Software BV. All Rights Reserved.