com.zeroturnaround.liverebel.util
Class LiveApplicationUtil

java.lang.Object
  extended by com.zeroturnaround.liverebel.util.LiveApplicationUtil

public class LiveApplicationUtil
extends Object

Generic utilities for LiveRebel applications.

Author:
Rein Raudjärv
See Also:
LiveRebelXml

Nested Class Summary
static class LiveApplicationUtil.ApplicationType
          Use this instead
 
Field Summary
static String LIVEREBEL_DIRECTORY
           
static String LIVEREBEL_PREFIX
           
static String META_INF_PREFIX
           
static String TYPE_EAR
          Deprecated.  
static String TYPE_JAR
          Deprecated.  
static String TYPE_WAR
          Deprecated.  
static String TYPE_ZIP
          Deprecated.  
static String WEB_INF_CLASSES_PREFIX
           
 
Constructor Summary
LiveApplicationUtil()
           
 
Method Summary
static void checkEarModuleLiveRebelXml(File application)
          Checks that EAR module application names do not overlap.
static LiveApplicationUtil.ApplicationType findApplicationType(File application)
          Detects the application type.
static LiveApplicationUtil.ApplicationType findApplicationType(File application, String originalFilename)
           
static Set<String> findEarModulePaths(File application)
          Finds the module paths of an EAR.
protected static LiveApplicationUtil.ApplicationType findJavaArchiveType(File application)
           
static LiveRebelXml findLiveRebelXml(File application)
          Finds and parses a liverebel.xml of the given application.
static LiveRebelXml findLiveRebelXml(File application, String prefix)
          Finds and parses a liverebel.xml of the given application.
static LiveRebelXml findLiveRebelXml(ZipInputStream applicationAsStream)
          Finds and parses a liverebel.xml of the given application.
static byte[] findLiveRebelXmlContents(File application)
          Finds the liverebel.xml contents in the given application.
static byte[] findLiveRebelXmlContents(File application, String prefix)
          Finds the liverebel.xml contents in the given application.
static byte[] findLiveRebelXmlContents(ZipInputStream applicationAsStream)
          Finds the liverebel.xml contents in the given application.
static String getDefaultContextPath(String appId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_JAR

public static final String TYPE_JAR
Deprecated. 
These are for compatibility and jr-core!

See Also:
Constant Field Values

TYPE_WAR

public static final String TYPE_WAR
Deprecated. 
These are for compatibility and jr-core!

See Also:
Constant Field Values

TYPE_EAR

public static final String TYPE_EAR
Deprecated. 
These are for compatibility and jr-core!

See Also:
Constant Field Values

TYPE_ZIP

public static final String TYPE_ZIP
Deprecated. 
These are for compatibility and jr-core!

See Also:
Constant Field Values

LIVEREBEL_DIRECTORY

public static final String LIVEREBEL_DIRECTORY
See Also:
Constant Field Values

WEB_INF_CLASSES_PREFIX

public static final String WEB_INF_CLASSES_PREFIX
See Also:
Constant Field Values

LIVEREBEL_PREFIX

public static final String LIVEREBEL_PREFIX
See Also:
Constant Field Values

META_INF_PREFIX

public static final String META_INF_PREFIX
See Also:
Constant Field Values
Constructor Detail

LiveApplicationUtil

public LiveApplicationUtil()
Method Detail

findApplicationType

public static LiveApplicationUtil.ApplicationType findApplicationType(File application)
Detects the application type.

Parameters:
application - EAR, WAR or JAR file/directory (not null).
Returns:
either EAR, WAR or JAR.

findApplicationType

public static LiveApplicationUtil.ApplicationType findApplicationType(File application,
                                                                      String originalFilename)

findJavaArchiveType

protected static LiveApplicationUtil.ApplicationType findJavaArchiveType(File application)

findEarModulePaths

public static Set<String> findEarModulePaths(File application)
Finds the module paths of an EAR.

Parameters:
application - EAR directory or file.
Returns:
module paths of this EAR.

findLiveRebelXml

public static LiveRebelXml findLiveRebelXml(File application)
Finds and parses a liverebel.xml of the given application.

Parameters:
application - EAR, WAR or JAR file/directory.
Returns:
liverebel.xml of this application or null if no liverebel.xml was found.

findLiveRebelXml

public static LiveRebelXml findLiveRebelXml(File application,
                                            String prefix)
Finds and parses a liverebel.xml of the given application.

Parameters:
application - EAR, WAR or JAR file/directory.
prefix - a root directory to perform the search in.
Returns:
liverebel.xml of this application or null if no liverebel.xml was found.

findLiveRebelXml

public static LiveRebelXml findLiveRebelXml(ZipInputStream applicationAsStream)
Finds and parses a liverebel.xml of the given application.

Parameters:
applicationAsStream - ZipInputStream from EAR, WAR or JAR file.
Returns:
liverebel.xml of this application or null if no liverebel.xml was found.

findLiveRebelXmlContents

public static byte[] findLiveRebelXmlContents(File application)
Finds the liverebel.xml contents in the given application.

Parameters:
application - EAR, WAR, JAR or ZIP file/directory.
Returns:
liverebel.xml contents of this application or null if nothing found.

findLiveRebelXmlContents

public static byte[] findLiveRebelXmlContents(File application,
                                              String prefix)
Finds the liverebel.xml contents in the given application.

Parameters:
application - EAR, WAR, JAR or ZIP file/directory.
prefix - a root directory to perform the search in.
Returns:
liverebel.xml contents of this application or null if nothing found.

findLiveRebelXmlContents

public static byte[] findLiveRebelXmlContents(ZipInputStream applicationAsStream)
Finds the liverebel.xml contents in the given application.

Parameters:
applicationAsStream - ZipInputStream from EAR, WAR or JAR file.
Returns:
liverebel.xml contents of this application or null if nothing found.

checkEarModuleLiveRebelXml

public static void checkEarModuleLiveRebelXml(File application)
                                       throws IOException
Checks that EAR module application names do not overlap.

Parameters:
application - from EAR, WAR or JAR file.
Throws:
IOException

getDefaultContextPath

public static String getDefaultContextPath(String appId)


Copyright © 2013. All Rights Reserved.