org.ow2.jonas.lib.util
Class JModule

java.lang.Object
  extended by org.ow2.jonas.lib.util.JModule

public class JModule
extends Object

This class implements utility methods for the manipulation of application modules.

Author:
Adriana Danes

Field Summary
static String CONF_DIR
          name of the directory containig configuration.
static String DEPLOY_DIR
           
static String EAR_CHILD_DIR
           
static String EAR_CONFIRM_FILE
           
static String EAR_EXTENSION
           
static String EJBJAR_CHILD_DIR
          Child directory of a expanded container.
static String EJBJAR_CONFIRM_FILE
          xml file in a child directory of a expanded container.
static String EJBJAR_EXTENSION
          file extension containing the different module types.
static String JONAS_BASE
           
static String PROPS_EXTENSION
          properties file extension.
static String RAR_CHILD_DIR
           
static String RAR_CONFIRM_FILE
           
static String RAR_EXTENSION
           
static String WAR_CHILD_DIR
           
static String WAR_CONFIRM_FILE
           
static String WAR_EXTENSION
           
 
Constructor Summary
JModule()
           
 
Method Summary
static ArrayList<String> getDatasourcePropsInDir()
           
static ArrayList<String> getFilesInDir(String dirName, String extension)
           
static ArrayList<String> getInstalledContainersInDir(String dirName, String extension)
          Return the list of all installed modules/apps in a directory.
static ArrayList<String> getInstalledContainersInDir(String p_DirName, String p_Extension, String p_DirChildConfirm, String p_FileConfirm)
          Return the list of all installed containers in a directory.
static ArrayList<URL> getInstalledFileInDir(String dirName, String extension)
          Return the URL list of files (possibly directories) having a given extension located in a given directory.
static ArrayList<String> getMailFactoryPropsInDir()
           
static ArrayList<String> getMailFactoryPropsInDir(String type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EJBJAR_EXTENSION

public static final String EJBJAR_EXTENSION
file extension containing the different module types.

See Also:
Constant Field Values

RAR_EXTENSION

public static final String RAR_EXTENSION
See Also:
Constant Field Values

WAR_EXTENSION

public static final String WAR_EXTENSION
See Also:
Constant Field Values

EAR_EXTENSION

public static final String EAR_EXTENSION
See Also:
Constant Field Values

EJBJAR_CHILD_DIR

public static final String EJBJAR_CHILD_DIR
Child directory of a expanded container.

See Also:
Constant Field Values

RAR_CHILD_DIR

public static final String RAR_CHILD_DIR
See Also:
Constant Field Values

WAR_CHILD_DIR

public static final String WAR_CHILD_DIR
See Also:
Constant Field Values

EAR_CHILD_DIR

public static final String EAR_CHILD_DIR
See Also:
Constant Field Values

EJBJAR_CONFIRM_FILE

public static final String EJBJAR_CONFIRM_FILE
xml file in a child directory of a expanded container.

See Also:
Constant Field Values

RAR_CONFIRM_FILE

public static final String RAR_CONFIRM_FILE
See Also:
Constant Field Values

WAR_CONFIRM_FILE

public static final String WAR_CONFIRM_FILE
See Also:
Constant Field Values

EAR_CONFIRM_FILE

public static final String EAR_CONFIRM_FILE
See Also:
Constant Field Values

JONAS_BASE

public static final String JONAS_BASE

DEPLOY_DIR

public static final String DEPLOY_DIR

PROPS_EXTENSION

public static final String PROPS_EXTENSION
properties file extension.

See Also:
Constant Field Values

CONF_DIR

public static final String CONF_DIR
name of the directory containig configuration.

See Also:
Constant Field Values
Constructor Detail

JModule

public JModule()
Method Detail

getFilesInDir

public static ArrayList<String> getFilesInDir(String dirName,
                                              String extension)
                                       throws Exception
Throws:
Exception

getDatasourcePropsInDir

public static ArrayList<String> getDatasourcePropsInDir()
                                                 throws Exception
Throws:
Exception

getMailFactoryPropsInDir

public static ArrayList<String> getMailFactoryPropsInDir(String type)
                                                  throws Exception
Throws:
Exception

getMailFactoryPropsInDir

public static ArrayList<String> getMailFactoryPropsInDir()
                                                  throws Exception
Throws:
Exception

getInstalledFileInDir

public static ArrayList<URL> getInstalledFileInDir(String dirName,
                                                   String extension)
                                            throws MalformedURLException,
                                                   IOException
Return the URL list of files (possibly directories) having a given extension located in a given directory.

Parameters:
dirName - name of the directory to lookup
extension - extension to check
Returns:
list of URLs of the files/directories which were found
Throws:
MalformedURLException - If the path cannot be parsed as a URL
IOException - If an I/O error occurs, which is possible because the construction of the canonical pathname may require file system queries

getInstalledContainersInDir

public static ArrayList<String> getInstalledContainersInDir(String p_DirName,
                                                            String p_Extension,
                                                            String p_DirChildConfirm,
                                                            String p_FileConfirm)
                                                     throws Exception
Return the list of all installed containers in a directory. The container may be :
- a archive file container with a known extension : jar, war, ear, rar
- a directory where the container is expanded
To control if a directory contains a expanded container, it's necessary to provide the child directory and the xml file that confirm the expanded container.
Parameter example to retrieve :
- web application : war, WEB-INF, web.xml - application : ear, META-INF, application.xml - ejb container : jar, META-INF, ejb-jar.xml - resource : rar, META-INF, ra.xml

Parameters:
p_DirName - The name of the directory to find
p_Extension - The extension of container (jar, war, ear, rar)
p_DirChildConfirm - The child directory that confirm the container
p_FileConfirm - The xml file inside the child directory that confirm the container
Returns:
A list of absolute path container
Throws:
Exception

getInstalledContainersInDir

public static ArrayList<String> getInstalledContainersInDir(String dirName,
                                                            String extension)
                                                     throws Exception
Return the list of all installed modules/apps in a directory. The container may be :
- a archive file container with a known extension : jar, war, ear, rar
- a directory where the container is expanded

Parameters:
dirName - The name of the directory to find
extension - The extension of container (jar, war, ear, rar)
Returns:
A list of absolute paths
Throws:
Exception


Copyright © 2010 OW2 Consortium. All Rights Reserved.