All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.mb.ZipRepositoryModel

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

public class ZipRepositoryModel
extends RepositoryModel
Contains the function for reading and writing a zip file repository. In addition to element files, a zip file repository can contain an optional META-INF/MANIFEST.MF file. This manifest can be a Sun-style manifest or an IBM Bean Extender manifest. Typically, a zip file will not contain a manifest.

If the zip file repository contains a manifest, it will be used to classify the element files in the repository. If no manifest is present, the code will attempt to guess at the organization of the elements. Currently, the heuristics involved assume that there is only one Bean per directory, and the element names have to be along the lines of

   <beanname>.class
   <beanname>BeanInfo.class
   <beanname>Icon.class
   <beanname>Image.gif
   ...
 

The URL syntax for specifying a .zip file repository is:

beans.zip:[drive_letter:]/<path>/<filename>.zip
 

Example:

beans.zip:C:/this/is/a/path/to/a/ZipRepository.zip
 

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 ZipRepositoryModel(URL, int)
Constructs a ZipRepositoryModel.

Method Index

 o doClose()
Closes the RepositoryModel.
 o doOpen()
Opens the ZipRepositoryModel, determines which files exist in the repository, and builds a set of ManagedBeans and MBElements to reflect the repository contents.
 o reconstituteManagedBean(ManagedBean)
Re-loads the MBElement data for the specified ManagedBean from this RepositoryModel.

Constructors

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

Parameters:
url - The location of the repository.
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 ZipRepositoryModel, determines which files exist in the repository, and builds a set of ManagedBeans and MBElements to reflect the repository contents.

Throws: FileNotFoundException
Thrown if the repository cannot be found in the file system.
Throws: IOException
Thrown if an error occurs while reading the repository.
Throws: InstantiationException
Thrown if an error occurs while building an MBElement
Throws: IllegalAccessException
Thrown if an error occurs while 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 getRepositoryName().

Throws: IOException
Thrown if an IO problem occurs while writing the RepositoryModel.
Overrides:
doClose in class RepositoryModel
 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