All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.mb.DirectoryRepositoryModel

java.lang.Object
   |
   +----com.ibm.beans.mb.RepositoryModel
           |
           +----com.ibm.beans.mb.DirectoryRepositoryModel

public class DirectoryRepositoryModel
extends RepositoryModel
This class contains the function for reading from and writing to a directory repository. A directory repository is an expanded JAR file. It should contain, in addition to element files, a META-INF/MANIFEST.MF file. This manifest can be a Sun-style manifest, an IBM Bean Extender enhanced manifest, or missing entirely. If the manifest is not present, the DirectoryRepositoryModel has to make some guesses about the structure of the elements. In this last case, it is very important that there be only one bean per directory, and that the elements strictly follow the beans naming conventions:

   <beanname>.class
   <beanname>BeanInfo.class
   <beanname>Icon.class
   <beanname>Image.gif
   ...
 
For details on the heuristics that are used when a manifest is not present, see the class MBElementFactory.

The URL syntax for specifying a directory repository is:

beans.directory:[drive_letter:]/<path>
 

For example:

beans.directory:f:/this/is/a/path/to/a/DirectoryRepository
 

Note that RepositoryModels are obtained from the RepositoryModelFactory. Typical use of a RepositoryModel is:

    RepositoryModelFactory.initialize();
    ...
    repo = RepositoryModelFactory.createRepositoryModel();
    repo.doOpen(); // reads repository (if necessary)
    ...
    repo.doClose(); // writes repository (if necessary)
    RepositoryModelFactory.destroyRepositoryModel(repo);
 

This RepositoryModel currently does not support write upon signed repositories. Signed repositories automatically become READ_ONLY when opened.

See Also:
RepositoryModel, RepositoryModelFactory

Constructor Index

 o DirectoryRepositoryModel(URL, int)
Constructs a DirectoryRepositoryModel.

Method Index

 o doClose()
Closes the RepositoryModel.
 o doOpen()
Opens the DirectoryRepository, discovers what files exist in the repository, and builds a set of ManagedBeans and MBElements to reflect the repository contents.
 o getWriteManifest()
Returns true if a Manifest is to be written for the files in this DirectoryRepositoryModel.
 o reconstituteManagedBean(ManagedBean)
Re-loads the MBElement data for the specified ManagedBean from this RepositoryModel.
 o setWriteManifest(boolean)
Specifies whether a manifest is to be written for the files in this DirectoryRepositoryModel.

Constructors

 o DirectoryRepositoryModel
 protected DirectoryRepositoryModel(URL url,
                                    int mode)
Constructs a DirectoryRepositoryModel.

Parameters:
url - The location of the repository, given as a URL.
mode - READ_ONLY, WRITE_ONLY, or READ_WRITE.
See Also:
RepositoryModel, RepositoryModelFactory

Methods

 o doOpen
 public synchronized void doOpen() throws FileNotFoundException, InstantiationException, IllegalAccessException, InstantiationError, IOException
Opens the DirectoryRepository, discovers what files exist in the repository, and builds a set of ManagedBeans and MBElements to reflect the repository contents.

Throws: FileNotFoundException
Thrown when the repository cannot be found in the file system.
Throws: IOException
Thrown if there are problems reading the repository.
Throws: InstantiationException
Thrown if an error occurs when building an MBElement.
Throws: IllegalAccessException
Thrown if an error occurs when building an MBElement.
Throws: InstantiationError
Thrown if an attempt is made to build an unknown subclass of MBElement or if a file listed in the manifest does not exist.
Overrides:
doOpen in class RepositoryModel
 o doClose
 public synchronized void doClose() throws IOException
Closes the RepositoryModel. If the RepositoryModel was opened in WRITE_ONLY or READ_WRITE mode, the repository is written to the location specified by getRepositoryURL().

Throws: IOException
Thrown if an IO problem occurs while writing the RepositoryModel.
Overrides:
doClose in class RepositoryModel
 o setWriteManifest
 public synchronized void setWriteManifest(boolean v)
Specifies whether a manifest is to be written for the files in this DirectoryRepositoryModel.

Parameters:
v - true to write a manifest; false to inhibit writing a manifest.
 o getWriteManifest
 public synchronized boolean getWriteManifest()
Returns true if a Manifest is to be written for the files in this DirectoryRepositoryModel.

Returns:
true if a Manifest is to be written for the files in this DirectoryRepositoryModel; false otherwise.
 o reconstituteManagedBean
 public synchronized boolean reconstituteManagedBean(ManagedBean mb) throws IOException
Re-loads the MBElement data for the specified ManagedBean from this RepositoryModel. Use this method after a ManagedBean is deserialized.

Parameters:
mb - The ManagedBean to be reconstituted.
Returns:
true if successful, false otherwise.
Throws: IOException
Thrown if an IO problem occurs while reading the RepositoryModel or the miscellaneous MBElement files.
Overrides:
reconstituteManagedBean in class RepositoryModel

All Packages  Class Hierarchy  This Package  Previous  Next  Index