Package org.wso2.carbon.server.util
Class Utils
java.lang.Object
org.wso2.carbon.server.util.Utils
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidarchiveDir(String destArchive, String sourceDir) Archive a directorystatic voidclearPrefixedSystemProperties(String prefix, Map<String, String> targetPropertyMap) clearPrefixedSystemProperties clears System Properties by writing null properties in the targetPropertyMap that match a prefixstatic voidCopies src file to dst file.static voidcopyFileToDir(File src, File dst) Copies src file to dst directory.static voidcreateBundle(File jarFile, File bundle, Manifest manifest) Create an OSGi bundle out of a JAR filestatic voidcreateBundle(File jarFile, File targetDir, Manifest mf, String extensionPrefix) Create an OSGi bundle out of a JAR filestatic booleanDeletes all files and subdirectories under dir.static voidstatic voidextractFromStream(InputStream inputStream, String extractDir) static String[]getArgs()static Filestatic FilegetBundleDirectory(String bundleDir) Create invalid input: '&' return the bundle directorystatic Filestatic Stringprotected static StringgetZipEntryPath(File f, String archiveSourceDir) static PropertiesloadProperties(String filePath) loadProperties is a convenience method to load properties from a servlet context resourcestatic Stringstatic voidstatic Stringprotected static voidzipDir(File zipDir, ZipOutputStream zos, String archiveSourceDir)
-
Field Details
-
JAR_TO_BUNDLE_DIR
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getCarbonRepoPath
-
getCarbonComponentRepo
-
printUsages
public static void printUsages() -
searchFor
-
getArgs
-
getBundleDirectory
Create invalid input: '&' return the bundle directory- Parameters:
bundleDir- The relative path of directory which contains the jars to be made into bundles- Returns:
- The bundle directory
-
createBundle
public static void createBundle(File jarFile, File targetDir, Manifest mf, String extensionPrefix) throws IOException Create an OSGi bundle out of a JAR file- Parameters:
jarFile- The jarfile to be bundledtargetDir- The directory into which the created OSGi bundle needs to be placed into.mf- The bundle manifest fileextensionPrefix- Prefix, if any, for the bundle- Throws:
IOException- If an error occurs while reading the jar or creating the bundle
-
createBundle
Create an OSGi bundle out of a JAR file- Parameters:
jarFile- The jarfile to be bundledbundle- The bundle to be createdmanifest- The manifest file- Throws:
IOException- If an error occurs while reading the jar or creating the bundle
-
deleteDir
Deletes all files and subdirectories under dir. Returns true if all deletions were successful. If a deletion fails, the method stops attempting to delete and returns false. -
archiveDir
Archive a directory- Parameters:
destArchive-sourceDir-- Throws:
IOException
-
zipDir
protected static void zipDir(File zipDir, ZipOutputStream zos, String archiveSourceDir) throws IOException - Throws:
IOException
-
getZipEntryPath
-
copyFileToDir
Copies src file to dst directory. If the dst directory does not exist, it is created- Throws:
IOException
-
copyFile
Copies src file to dst file. If the dst file does not exist, it is created- Throws:
IOException
-
extract
- Throws:
IOException
-
extractFromStream
- Throws:
IOException
-
parseJar
- Parameters:
jarFile- jar file location- Returns:
- package name list separated by ","
- Throws:
IOException- IOException
-
getBundleConfigDirectory
-
clearPrefixedSystemProperties
public static void clearPrefixedSystemProperties(String prefix, Map<String, String> targetPropertyMap) clearPrefixedSystemProperties clears System Properties by writing null properties in the targetPropertyMap that match a prefix- Parameters:
prefix- prefixtargetPropertyMap- targetPropertyMap
-
loadProperties
loadProperties is a convenience method to load properties from a servlet context resource- Parameters:
filePath- - path to load properties from- Returns:
- the properties
-