All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.mb.RepositoryModelFactory

java.lang.Object
   |
   +----com.ibm.beans.mb.RepositoryModelFactory

public final class RepositoryModelFactory
extends Object
implements Serializable
This class defines a static singleton object that is accessed when a RepositoryModel needs to be created or destroyed.

A typically use of the RepositoryModelFactory is:

    RepositoryModelFactory.initialize();
    ...
    repo = RepositoryModelFactory.createRepositoryModel();
    repo.doOpen(); // reads repository (if necessary)
    ...
    repo.doClose(); // writes repository (if necessary)
    RepositoryModelFactory.destroyRepositoryModel(repo);
 
RepositoryModelFactory will also generate custom, user-supplied RepositoryModels. See the section on ManagedBeans/Repositories in the Guide To Features and the documentation for RepositoryModelFactoryInterface for more details.

See Also:
RepositoryModel, RepositoryModelFactoryInterface

Constructor Index

 o RepositoryModelFactory()
Constructor for RepositoryModelFactory.

Method Index

 o convertFilenameToURL(String)
Converts a repository file name to a URL name.
 o convertNameIntoCanonicalName(String)
Converts a repository name into canonical form.
 o createRepositoryModel(Class, String, int)
Creates a RepositoryModel if one is not instantiated.
 o createRepositoryModel(String, int)
Creates a RepositoryModel if one is not instantiated.
 o createRepositoryModel(URL, int)
Creates a RepositoryModel if one is not instantiated.
 o destroyRepositoryModel(RepositoryModel)
Destroys a RepositoryModel once the user is finished with it.
 o initialize()
Initializes the entire Bean Management subsystem.

Constructors

 o RepositoryModelFactory
 protected RepositoryModelFactory()
Constructor for RepositoryModelFactory.

Methods

 o initialize
 public static synchronized void initialize()
Initializes the entire Bean Management subsystem. This method must be called before any attempt is made to construct a URL specifying a repository. Ideally, this call goes in the main() method of the application. Because the Java runtime does not provide any way to programmatically initialize something at start-up time, the developer must call this initialization method.

The BeanBagModel constructors call this method, so if you are using BeanBagModels, you probably won't have to make this initialization.

This method needs to be called only once, but calling it multiple times will not cause problems.

 o createRepositoryModel
 public static synchronized RepositoryModel createRepositoryModel(URL url,
                                                                  int mode) throws NoSuchMethodException, InstantiationException, IllegalAccessException, MalformedURLException, InvocationTargetException
Creates a RepositoryModel if one is not instantiated. If one already exists, it is returned to the caller. Supported access modes are multiple read access (with no writers) or single write access. Currently, network repositories are READ_ONLY.

This method accepts a URL object that specifies a repository.

Below are the repository types currently supported by the Bean Management subsystem and the URL syntax used to specify them:

Parameters:
url - The location of this repository.
mode - READ_ONLY, WRITE_ONLY, or READ_WRITE.
Returns:
The requested RepositoryModel, or null if the create request is denied. For instance, null is returned if a WRITE_ONLY request is made on a repository that is already accessed READ_ONLY.
Throws: NoSuchMethodException
Thrown if an error occurs while constructing the repository access object.
Throws: InstantiationException
Thrown if an error occurs while building the RepositoryModel.
Throws: IllegalAccessException
Thrown if an error occurs while building the RepositoryModel.
Throws: MalformedURLException
Thrown if the repository name is incorrectly formatted.
Throws: InvocationTargetException
Thrown if an error occurs while building the RepositoryModel.
See Also:
RepositoryModel, URL
 o createRepositoryModel
 public static synchronized RepositoryModel createRepositoryModel(String stringURL,
                                                                  int mode) throws NoSuchMethodException, InstantiationException, IllegalAccessException, MalformedURLException, InvocationTargetException
Creates a RepositoryModel if one is not instantiated. If one already exists, it is returned to the caller. Supported access modes are multiple read access (with no writers) or single write access. Currently, network repositories are READ_ONLY.

This method accepts a String object containing a URL which specifies a repository.

Below are the repository types currently supported by the Bean Management subsystem and the URL syntax used to specify them:

Parameters:
url - The location of this repository.
mode - READ_ONLY, WRITE_ONLY, or READ_WRITE.
Returns:
The requested RepositoryModel, or null if the create request is denied. For instance, null is returned if a WRITE_ONLY request is made on a repository that is already accessed READ_ONLY.
Throws: NoSuchMethodException
Thrown if an error occurs while constructing the repository access object.
Throws: InstantiationException
Thrown if an error occurs while building the RepositoryModel.
Throws: IllegalAccessException
Thrown if an error occurs while building the RepositoryModel.
Throws: MalformedURLException
Thrown if the repository name is incorrectly formatted.
Throws: InvocationTargetException
Thrown if an error occurs while building the RepositoryModel.
See Also:
RepositoryModel, URL
 o createRepositoryModel
 public static synchronized RepositoryModel createRepositoryModel(Class c,
                                                                  String name,
                                                                  int mode) throws NoSuchMethodException, InstantiationException, IllegalAccessException, MalformedURLException, InvocationTargetException
Creates a RepositoryModel if one is not instantiated. If one already exists, it is returned to the caller. Supported access modes are multiple read access (with no writers) or single write access.

This is the original interface and does not provide the capability of creating network repositories or using URL syntax to specify a repository.

Parameters:
c - The RepositoryModel class to use to access this RepositoryModel. This should always be null.
name - The location of this repository, typically the location of a directory or a JAR file in the file system.
mode - READ_ONLY, WRITE_ONLY, or READ_WRITE.
Returns:
The requested RepositoryModel or null if the create request is denied. For instance, null is returned if a WRITE_ONLY request is made on a repository that is already accessed READ_ONLY.
Throws: NoSuchMethodException
Thrown if an error occurs while constructing the repository access object.
Throws: InstantiationException
Thrown if an error occurs while building the RepositoryModel.
Throws: IllegalAccessException
Thrown if an error occurs while building the RepositoryModel.
Throws: MalformedURLException
Thrown if the repository name is incorrectly formatted.
Throws: InvocationTargetException
Thrown if an error occurs while building the RepositoryModel.
See Also:
RepositoryModel
 o destroyRepositoryModel
 public static synchronized void destroyRepositoryModel(RepositoryModel r)
Destroys a RepositoryModel once the user is finished with it. In actuality, the RepositoryModel reference count is decremented. The RepositoryModel is removed from the RepositoryModelFactory hash table when the reference count reaches zero.

Parameters:
r - The RepositoryModel to be destroyed.
See Also:
RepositoryModel
 o convertFilenameToURL
 public static String convertFilenameToURL(String name)
Converts a repository file name to a URL name.

Parameters:
name - The repository file name. For example:
"..\\myRepos\\buttons.jar"
Returns:
The URL form of the name. For example:
"beans.jar:/F:\\myStuff\\myRepos\\buttons.jar"
 o convertNameIntoCanonicalName
 protected static String convertNameIntoCanonicalName(String name)
Converts a repository name into canonical form.

Parameters:
name - The repository name. For example:
"..\\myRepos\\buttons.jar"
Returns:
The canonical form of the name. For example:
"F:\\myStuff\\myRepos\\buttons.jar"

All Packages  Class Hierarchy  This Package  Previous  Next  Index