Class BundleManager
java.lang.Object
org.netbeans.jemmy.BundleManager
Provides functionality to work with a bunch of resource files.
- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a Bundle to the managed collection of resource files.intcalculateResources(String key) Counts the number of resource occurences in all the managed Bundles.Creates a shallow copy of this BundleManager.Returns a Bundle given it's symbolic ID.getResource(String key) Searches for a resource in all the managed Bundles.getResource(String bundleID, String key) Returns resource from ID bundle.load()Loads resources from simple text file pointed by jemmy.resources system property.loadBundleFromFile(String fileName, String ID) Create a new Bundle, load resources from a simple text file, and add the bundle.loadBundleFromJar(String fileName, String entryName, String ID) Loads resources from file in jar archive into new Bundle object and adds it.loadBundleFromResource(ClassLoader cl, String resource, String ID) loadBundleFromStream(InputStream stream, String ID) loadBundleFromZip(String fileName, String entryName, String ID) Loads resources from file in zip archive into new Bundle object and adds it.voidprint(PrintStream stream) Prints bundles contents.voidprint(PrintWriter writer) Prints bundles contents.removeBundle(String ID) Removes a Bundle from the managed collection of resource files.
-
Constructor Details
-
BundleManager
public BundleManager()Bundle manager constructor.
-
-
Method Details
-
addBundle
-
removeBundle
-
getBundle
-
loadBundleFromFile
public Bundle loadBundleFromFile(String fileName, String ID) throws IOException, FileNotFoundException Create a new Bundle, load resources from a simple text file, and add the bundle. Load resources from a text file to a new Bundle object. The new Bundle is added to the collection of objects managed by thisBundleManager.- Parameters:
fileName- Name of a file to load resources from.ID- Symbolic bundle ID used to identify the new bundle used to manage the resources from the file.- Returns:
- a newly created bundle.
- Throws:
IOExceptionFileNotFoundException
-
loadBundleFromStream
public Bundle loadBundleFromStream(InputStream stream, String ID) throws IOException, FileNotFoundException - Throws:
IOExceptionFileNotFoundException
-
loadBundleFromResource
public Bundle loadBundleFromResource(ClassLoader cl, String resource, String ID) throws IOException, FileNotFoundException - Throws:
IOExceptionFileNotFoundException
-
load
Loads resources from simple text file pointed by jemmy.resources system property. The resources are loaded into the Bundle with ID "". Does not do anything if jemmy.resources has not been set or is empty.- Returns:
- a newly created bundle.
- Throws:
IOExceptionFileNotFoundException
-
loadBundleFromJar
public Bundle loadBundleFromJar(String fileName, String entryName, String ID) throws IOException, FileNotFoundException Loads resources from file in jar archive into new Bundle object and adds it.- Parameters:
fileName- Name of jar file.entryName- ?enryName? Name of file to load resources from.ID- Symbolic bundle id- Returns:
- a newly created bundle.
- Throws:
IOExceptionFileNotFoundException
-
loadBundleFromZip
public Bundle loadBundleFromZip(String fileName, String entryName, String ID) throws IOException, FileNotFoundException, ZipException Loads resources from file in zip archive into new Bundle object and adds it.- Parameters:
fileName- Name of jar file.entryName- ?enryName? Name of file to load resources from.ID- Symbolic bundle id- Returns:
- a newly created bundle.
- Throws:
ZipExceptionIOExceptionFileNotFoundException
-
print
Prints bundles contents.- Parameters:
writer- Writer to print data in.
-
print
Prints bundles contents.- Parameters:
stream- Stream to print data in.
-
getResource
-
getResource
-
calculateResources
Counts the number of resource occurences in all the managed Bundles.- Parameters:
key- Resource key- Returns:
- the number of resource occurences with the given key among all the Bundles managed by this BundleManager.
-
cloneThis
Creates a shallow copy of this BundleManager. Does not copy bundles, only their references.- Returns:
- a copy of this BundleManager.
-