All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.builder.resolver.ResourceCollection

java.lang.Object
   |
   +----com.sun.wizards.builder.resolver.ResourceCollection

public class ResourceCollection
extends Object
This class is a collection of resources. A resource has a name and an associated type, as well as a designated ResourceResolver that knows how to resolve the resource. In addition, each resource can contain extra data that gets placed into the archive stream and used at runtime by objects that night read the stream.


Constructor Index

 o ResourceCollection()
Creates an empty ResourceCollection.

Method Index

 o addResource(String, String, byte[], ResourceResolver)
Add a single resource to the archive.
 o addResource(String, String, ResourceResolver)
Add a single resource to the archive.
 o addResources(String, String[], byte[][], ResourceResolver)
Add many resources to the archive.
 o addResources(String, String[], ResourceResolver)
Add many resources to the archive.
 o addResourceVector(Vector, ResourceResolver)
Adds the specified vector of resources to the table of resources for this collection.
 o countResources(String)
Counts the number of resources of the specified type in this Collection.
 o getExtraData(String, String)
Gets the extra data associated with a resource of the specified type, with the specified name
 o getNames(String)
Gets a list of resources and their resolvers, for a particular type.
 o getTypes()
Gets an orthogonal (i.e.

Constructors

 o ResourceCollection
 public ResourceCollection()
Creates an empty ResourceCollection.

Methods

 o addResourceVector
 public void addResourceVector(Vector resourceVector,
                               ResourceResolver resolver)
Adds the specified vector of resources to the table of resources for this collection. Each resource in the supplied array is assumed to be able to be resolved from the supplied ResourceResolver.

Parameters:
resourceVector - The vector containing wizard resource name(s). Each element of this array can be one of the following types:
  • String[] - The first element of this array is the type. Subsequent elements are resources of this type to be added to the archive. If type is null, A type of RuntimeClasses is assumed.
  • String - If the element is a String, the string is assumed to be the name of the resource. The type is assumed to be "RuntimeClasses"
resolver - The ResourceResolver that knows how to resolve all resources supplied by the resource list. No Extra Data can be associated with any resources added via this method.
 o addResources
 public void addResources(String type,
                          String name[],
                          ResourceResolver resolver)
Add many resources to the archive. The type argument specifies what type of resource is being added. During wizard creation, the supplied ResourceResolver is queried for this resource. No Extra Data is assumed. Each name is assumed of the same type, namely type.

Parameters:
type - The type of the resource.
name - The names of the resources.
resolver - The resolver responsible for resolving these resources.
 o addResources
 public void addResources(String type,
                          String name[],
                          byte extData[][],
                          ResourceResolver resolver)
Add many resources to the archive. The type argument specifies what type of resource is being added. During wizard creation, the supplied ResourceResolver is queried for this resource. No Extra Data is assumed. Each name is assumed of the same type, namely type.

Parameters:
type - The type of the resource.
name - The names of the resources.
extData - The extra data for each name, respective of the names
resolver - The resolver responsible for resolving these resources.
 o addResource
 public void addResource(String type,
                         String name,
                         ResourceResolver resolver)
Add a single resource to the archive. The type argument specifies what type of resource is being added. During wizard creation, the supplied ResourceResolver is queried for this resource. No extra data is assumed.

Parameters:
type - The type of the resource.
name - The name of the resource.
resolver - The resolver responsible for resolving these resources.
 o addResource
 public void addResource(String type,
                         String name,
                         byte extraData[],
                         ResourceResolver resolver)
Add a single resource to the archive. The type argument specifies what type of resource is being added. During wizard creation, the supplied ResourceResolver is queried for this resource. resource types include:

Parameters:
type - The type of the resource.
name - The name of the resource.
extraData - Any extra data to be associated with the resource. If this is null, no extra data will be associated with this resource.
resolver - The resolver responsible for resolving these resources.
 o getTypes
 public Vector getTypes()
Gets an orthogonal (i.e. no duplicates) list of types from this collection.

Returns:
A list of types included in this collection.
 o countResources
 public int countResources(String type)
Counts the number of resources of the specified type in this Collection.

Parameters:
type - The type to count
Returns:
The number of distinct resources within this Collection of the specified type, 0 <= count <= N
 o getNames
 public Hashtable getNames(String type)
Gets a list of resources and their resolvers, for a particular type. The value returned is a table of the following form:
 ResourceResolver, Vector (name1, name2, ..., nameN)
 ResourceResolver, Vector (name1, name2, ..., nameN)
 ...
 ResourceResolver, Vector (name1, name2, ..., nameN)
 

Parameters:
type - The desired type of returned resources.
Returns:
The table of resources.
 o getExtraData
 public byte[] getExtraData(String type,
                            String name)
Gets the extra data associated with a resource of the specified type, with the specified name

Parameters:
type - The type of resource
name - The name of the resource
Returns:
The extra data associated with the specified resource type and name, or an empty array if the resource has no extra data or the resource does not exist in this collection.

All Packages  Class Hierarchy  This Package  Previous  Next  Index