org.apache.itest
Class JarContent

java.lang.Object
  extended by org.apache.itest.JarContent
All Implemented Interfaces:
groovy.lang.GroovyObject

public abstract class JarContent
extends Object
implements groovy.lang.GroovyObject


Field Summary
static Object defaultExclPattern
           
 
Constructor Summary
JarContent()
           
 
Method Summary
static List applyExcludeFilter(List list, List filters)
          Filter out any entries which match given patterns
static String getJarName(String baseDir, String namePattern)
          Returns full name of a jar file by a pattern
static URL getJarURL(Class ref)
          Finds JAR URL of an object's class belongs to
static URL getJarURL(String className)
          Finds JAR URL of an object's class belongs to
 groovy.lang.MetaClass getMetaClass()
           
 Object getProperty(String name)
           
 Object invokeMethod(String name, Object args)
           
static List listContent(String jarFileName)
          Lists content of a given jar file excluding defaultExclPattern and any extra patterns set via setPatterns(java.util.List) call
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
static List setPatterns(List filterPatters)
          Set a list of new patterns to be applied in the processing of a jar file
 void setProperty(String name, Object value)
           
static void unpackJarContainer(Class ref, String destination, String includes)
          Finds and unpack a jar file by locating to what jar file a given class belongs and unpacking jar content to desalination according to given includes
static Object unpackJarContainer(String className, String destination, String includes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultExclPattern

public static Object defaultExclPattern
Constructor Detail

JarContent

public JarContent()
Method Detail

listContent

public static List listContent(String jarFileName)
                        throws IOException
Lists content of a given jar file excluding defaultExclPattern and any extra patterns set via setPatterns(java.util.List) call

Parameters:
jarFileName - file for a jar
Returns:
list of Strings representing jar's entries
Throws:
IOException - if file isn't found and anything else goes wrong

setPatterns

public static List setPatterns(List filterPatters)
Set a list of new patterns to be applied in the processing of a jar file

Parameters:
filterPatters - list of pattern strings
Returns:
list of currently set patterns. Next call of this method will reset the content of patterns' list.

applyExcludeFilter

public static List applyExcludeFilter(List list,
                                      List filters)
Filter out any entries which match given patterns

Parameters:
list - of entries
filters - list of patterns
Returns:
filtered-out list of entries

getJarURL

public static URL getJarURL(Class ref)
Finds JAR URL of an object's class belongs to

Parameters:
ref - Class reference of a class belongs to a jar file
Returns:
JAR URL or null if class doesn't belong to a JAR in the classpath

getJarURL

public static URL getJarURL(String className)
                     throws ClassNotFoundException
Finds JAR URL of an object's class belongs to

Parameters:
className - is full name of the class e.g. java.lang.String
Returns:
JAR URL or null if class doesn't belong to a JAR in the classpath
Throws:
ClassNotFoundException - if class specified by className wasn't found

getJarName

public static String getJarName(String baseDir,
                                String namePattern)
Returns full name of a jar file by a pattern

Parameters:
baseDir - to look for a jar under
namePattern - to look for a jar by
Returns:
name of the jar file if found; null otherwise

unpackJarContainer

public static void unpackJarContainer(Class ref,
                                      String destination,
                                      String includes)
                               throws IOException
Finds and unpack a jar file by locating to what jar file a given class belongs and unpacking jar content to desalination according to given includes

Parameters:
ref -
destination -
includes -
Throws:
IOException - if can't find class' jar file in the classpath

unpackJarContainer

public static Object unpackJarContainer(String className,
                                        String destination,
                                        String includes)
                                 throws IOException
Throws:
IOException

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public Object invokeMethod(String name,
                           Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(String name,
                        Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject


Copyright © 2011. All Rights Reserved.