alma::acs::eclipse::utils::jar::JarFileHelper Class Reference

Collaboration diagram for alma::acs::eclipse::utils::jar::JarFileHelper:
Collaboration graph
[legend]

List of all members.

Classes

class  JarFileNameFilter

Public Member Functions

 JarFileHelper (String name, String[] folders) throws Exception
 JarFileHelper (File file) throws Exception
int getPackages (Collection< String > javaPackages) throws IOException
void getClasses (Collection< String > javaClasses) throws IOException
Collection< String > getMatchingClasses (String name) throws IOException
String getFilePathName ()
String getName ()

Private Member Functions

void addJavaPackage (String str, Collection< String > vector)
void addJavaClass (String str, Collection< String > vector)

Private Attributes

final String name
final File file

Static Private Attributes

static final Logger logger = Logger.getAnonymousLogger()

Detailed Description

Objects from this class allow to browse the content of a jar file focusing on classes and packages.

There are 2 ways to use JarFileHelper objects:

  1. from the name of a jar like for example lc.jar: in this case the jar file is retrieved by following ACS rules i.e. ../lib, INROOT/lib...
  2. by passing directly the jar file like for example $INTROOT/lib/lc.jar

Given the name of a jar file, JarFile get the right jar file from the file system looking the folder as ACS rules. The content of thSe jar file is then examined to get the list of the java classes and packages it contains as well as any other info needed.

Note: this class is intended to work only with ACS distributed jar files.

Author:
acaproni

Constructor & Destructor Documentation

alma::acs::eclipse::utils::jar::JarFileHelper::JarFileHelper ( String  name,
String[]  folders 
) throws Exception [inline]

Constructor.

Parameters:
name The name of the ACS jar file (like lc.jar)
folders The folders to look for the jar files
Exceptions:
Exception 

References file, alma::acs::makesupport::AcsFileFinder::getFiles(), logger, and name.

alma::acs::eclipse::utils::jar::JarFileHelper::JarFileHelper ( File  file  )  throws Exception [inline]

Constructor

Parameters:
file The jar file

References file, and name.


Member Function Documentation

void alma::acs::eclipse::utils::jar::JarFileHelper::addJavaClass ( String  str,
Collection< String >  vector 
) [inline, private]

Add a java class to the vector if it is not already there.

The class name is calculated by checking the passed string.

Parameters:
str The entry of the jar that could point to a java class
vector The vector of classes where the package must be added

Referenced by getClasses().

void alma::acs::eclipse::utils::jar::JarFileHelper::addJavaPackage ( String  str,
Collection< String >  vector 
) [inline, private]

Add a java package to the vector if it is not already there.

The package name is calculated by checking the passed string

Parameters:
str The entry of the jar that could point to a jar
vector The vector of packages where the package must be added

Referenced by getPackages().

void alma::acs::eclipse::utils::jar::JarFileHelper::getClasses ( Collection< String >  javaClasses  )  throws IOException [inline]

Flush the java classes contained in this jar file into the passed vector.

Returns:
The java classes in the jar file

References addJavaClass(), and file.

Referenced by getMatchingClasses().

String alma::acs::eclipse::utils::jar::JarFileHelper::getFilePathName (  )  [inline]
Returns:
the absolute path of the file of the jar

References file.

Collection<String> alma::acs::eclipse::utils::jar::JarFileHelper::getMatchingClasses ( String  name  )  throws IOException [inline]

Check if a class with the given name is in the jar. The match is not done for the whole name of the class but from its initial part. For example if the parameter is Logging and the jar is lc.jar then the returned array contains LoggingClient and LoggingClientText

Parameters:
name The beginning of the name of the class
Returns:
A list of class names matching the parameter or null if no class name in the jar matches with the parameter
Exceptions:
IOException In case of error reading the jar file

References getClasses(), and name.

Referenced by alma::acs::eclipse::utils::jar::JarFolder::getJarsContainingClass().

String alma::acs::eclipse::utils::jar::JarFileHelper::getName (  )  [inline]
int alma::acs::eclipse::utils::jar::JarFileHelper::getPackages ( Collection< String >  javaPackages  )  throws IOException [inline]

Flush the java packages contained in this jar file into the passed vector.

Returns:
the number of java packages in the jar file
Exceptions:
IOException In case of error reading the jar file

References addJavaPackage(), and file.


Member Data Documentation

The jar file.

This file is obtained by scanning ACS folder like INTROOT, ACSROOT and so on

Referenced by getClasses(), getFilePathName(), getPackages(), and JarFileHelper().

final Logger alma::acs::eclipse::utils::jar::JarFileHelper::logger = Logger.getAnonymousLogger() [static, private]

The logger

Referenced by JarFileHelper().

The name of the jar file like for example lc.jar

Referenced by getMatchingClasses(), getName(), and JarFileHelper().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2