All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.mb.RepositoryModel

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

public abstract class RepositoryModel
extends Object
implements Serializable
This class contains the function for manipulating ManagedBeans contained within a RepositoryModel. Typically, interaction with a RepositoryModel involves calling a selectXXX() method to select a subset of ManagedBeans in the model, followed by a doXXX() method call to perform an operation on the selected ManagedBeans. Extensive notification support is provided to allow listeners to be informed of changes to the selection and to the RepositoryModel itself.

See Also:
RepositoryModelFactory, JarRepositoryModel, DirectoryRepositoryModel, ManagedBean, RepositoryModelChangeEvent, RepositoryModelChangeListener, RepositorySelectionChangeEvent, RepositorySelectionChangeListener

Variable Index

 o ENHANCED_MANIFEST
The output Manifest file will use IBM BeanExtender Enhanced Manifest tags.
 o ENHANCED_SPEC
If there is no Manifest file, the RepositoryModel will be populated using heuristics to determine which MBElements are Beans, BeanInfos, Customizers, etc.
 o JAVASOFT_MANIFEST
The output Manifest file will use JavaSoft Manifest tags.
 o READ_ONLY
Indicates that the RepositoryModel is read-only.
 o READ_WRITE
Indicates that the RepositoryModel is read-write.
 o STRICT_SPEC
The RepositoryModel will be populated strictly according to the JavaBeans spec.
 o WRITE_ONLY
Indicates that the RepositoryModel is write-only.

Constructor Index

 o RepositoryModel(URL, int)
Constructs base RepositoryModel function.

Method Index

 o addRepositoryModelChangeListener(RepositoryModelChangeListener)
Adds a listener to the list.
 o addRepositorySelectionChangeListener(RepositorySelectionChangeListener)
Adds a listener to the list.
 o addToDeleteList(MBElement)
Adds the MBElement parameter to a list of MBElements that have been deleted from this RepositoryModel.
 o buildMBManifest()
Builds a manifest for this RepositoryModel.
 o doAdd(ManagedBean)
Adds a ManagedBean to the RepositoryModel.
 o doAdd(ManagedBean[])
Adds an array of ManagedBeans to this RepositoryModel.
 o doClose()
Closes the RepositoryModel.
 o doDelete()
Deletes the currently selected ManagedBeans from this RepositoryModel.
 o doGetManagedBeans()
Gets an array of the currently selected ManagedBeans in this RepositoryModel.
 o doOpen()
Opens the DirectoryRepository.
 o dumpRepository()
Dumps the RepositoryModel MBManifest and all of its ManagedBeans.
 o fetchByteArrayForElement(MBMoniker, Class)
Gets the ByteArray for the MBElement that matches the given <moniker, class> pair.
 o fireRepositoryModelChangeEvent(RepositoryModelChangeEvent)
Distributes the event parameter to all registered listeners.
 o fireRepositorySelectionChangeEvent(RepositorySelectionChangeEvent)
Distributes the event parameter to all registered listeners.
 o getAllManagedBeans()
Gets an array of all of the ManagedBeans in this RepositoryModel.
 o getClassAccess()
Gets the Class of this RepositoryModel.
 o getDeleteList()
Gets the list of deleted MBElements.
 o getFixedFilename(String)
Fixes the file name part returned from the URL method getFile().
 o getIsEmpty()
Determines whether this RepositoryModel is empty.
 o getListOfSupportedElementTypes()
Gets a list of the MBElement types supported by this RepositoryModel.
 o getManagedBeanFactory()
Gets the registered ManagedBeanFactory or the default ManagedBeanFactory if none is registered.
 o getManagedBeans()
Gets a Vector of the ManagedBeans in this RepositoryModel.
 o getManifestStyle()
Gets the Manifest style for this RepositoryModel.
 o getMBElementFactory()
Gets the registered MBElementFactory or the default MBElementFactory if none is registered.
 o getMBManifest()
Gets the MBManifest of this RepositoryModel.
 o getPolicy()
Gets the RepositoryModel policy.
 o getReferenceCount()
Gets the reference count for this RepositoryModel.
 o getRepositoryModelMode()
Gets the mode of the RepositoryModel.
 o getRepositoryModelName()
Gets the name of this RepositoryModel.
 o getRepositoryModelURL()
Gets the URL of this RepositoryModel.
 o getSelectedManagedBeans()
Gets a Vector of the currently selected ManagedBeans in this RepositoryModel.
 o makeBeanName(String)
Generates a bean name from a moniker
 o makeElementName(String)
Generates an element name from a moniker
 o putRepositoryModel()
Writes the ByteArray representations of all of the MBElements in all of the ManagedBeans in this RepositoryModel to the working directory.
 o rawAdd(ManagedBean)
Adds a ManagedBean to this RepositoryModel.
 o reconstituteManagedBean(ManagedBean)
Re-loads the MBElement data of the specified ManagedBean from this RepositoryModel.
 o reconstituteRepositoryModel()
Re-reads all of the MBElement ByteArray information into each MBElement in each ManagedBean in the RepositoryModel.
 o registerManagedBeanFactory(ManagedBeanFactory)
Registers a ManagedBeanFactory object with this RepositoryModel.
 o registerMBElementFactory(MBElementFactory)
Registers an MBElementFactory object with this ManagedBean.
 o removeRepositoryModelChangeListener(RepositoryModelChangeListener)
Removes a listener from the list.
 o removeRepositorySelectionChangeListener(RepositorySelectionChangeListener)
Removes a listener from the list.
 o selectAll()
Selects all of the ManagedBeans in this RepositoryModel.
 o selectManagedBean(int)
Selects the ManagedBean at the specified index in this RepositoryModel.
 o selectManagedBean(ManagedBean)
Selects the ManagedBean argument in this RepositoryModel.
 o selectManagedBean(MBMoniker)
Selects the ManagedBeans in this RepositoryModel whose moniker matches mbMoniker.
 o selectNone()
If any ManagedBeans are selected, this method deselects them.
 o setClassAccess(Class)
Sets the Class of this RepositoryModel.
 o setManagedBeans(Vector)
Sets the Vector of ManagedBeans in this RepositoryModel.
 o setManifestStyle(int)
Sets the Manifest style for this RepositoryModel.
 o setMBManifest(MBManifest)
Sets the MBManifest of this RepositoryModel.
 o setPolicy(int)
Sets the RepositoryModel policy.
 o setReferenceCount(int)
Sets the reference count for this RepositoryModel.
 o setRepositoryModelMode(int)
Sets the mode of the RepositoryModel.
 o setRepositoryModelName(String)
Sets the name of this RepositoryModel.
 o setRepositoryModelURL(URL)
Sets the URL of this RepositoryModel.
 o setSelectedManagedBeans(Vector)
Sets the Vector of currently selected ManagedBeans in this RepositoryModel.
 o testMonikerForElement(MBMoniker)
Searches the RepositoryModel for an MBElement with the specified MBMoniker.
 o updateDigests()
Adds new SHA-1 and MD5 MessageDigest information to the manifest for this RepositoryModel.

Variables

 o READ_ONLY
 public static final int READ_ONLY
Indicates that the RepositoryModel is read-only.

 o WRITE_ONLY
 public static final int WRITE_ONLY
Indicates that the RepositoryModel is write-only.

 o READ_WRITE
 public static final int READ_WRITE
Indicates that the RepositoryModel is read-write.

 o STRICT_SPEC
 public static final int STRICT_SPEC
The RepositoryModel will be populated strictly according to the JavaBeans spec. STRICT_SPEC policy means:

 o ENHANCED_SPEC
 public static final int ENHANCED_SPEC
If there is no Manifest file, the RepositoryModel will be populated using heuristics to determine which MBElements are Beans, BeanInfos, Customizers, etc. This is the default policy.

 o ENHANCED_MANIFEST
 public static final int ENHANCED_MANIFEST
The output Manifest file will use IBM BeanExtender Enhanced Manifest tags.

 o JAVASOFT_MANIFEST
 public static final int JAVASOFT_MANIFEST
The output Manifest file will use JavaSoft Manifest tags.

Constructors

 o RepositoryModel
 protected RepositoryModel(URL url,
                           int mode)
Constructs base RepositoryModel function.

Parameters:
url - The location of the repository.
mode - READ_ONLY, WRITE_ONLY, or READ_WRITE.
See Also:
RepositoryFactory

Methods

 o selectAll
 public synchronized void selectAll()
Selects all of the ManagedBeans in this RepositoryModel.

See Also:
ManagedBean
 o selectNone
 public synchronized void selectNone()
If any ManagedBeans are selected, this method deselects them.

See Also:
ManagedBean
 o selectManagedBean
 public synchronized void selectManagedBean(int i) throws IllegalAccessException
Selects the ManagedBean at the specified index in this RepositoryModel. Any previously selected ManagedBeans are first deselected.

Parameters:
i - The index of the ManagedBean to be selected.
Throws: IllegalAccessException
Thrown if the index parameter is outside of the range of the Vector.
See Also:
ManagedBean
 o selectManagedBean
 public synchronized void selectManagedBean(ManagedBean m) throws IllegalAccessException
Selects the ManagedBean argument in this RepositoryModel. Any previously selected ManagedBeans are first deselected.

Parameters:
m - The ManagedBean to be selected.
Throws: IllegalAccessException
Thrown if this method indexes outside of the range of the Vector.
See Also:
ManagedBean
 o selectManagedBean
 public synchronized void selectManagedBean(MBMoniker mbMoniker)
Selects the ManagedBeans in this RepositoryModel whose moniker matches mbMoniker. Any previously selected ManagedBeans are first deselected.

Parameters:
mbMoniker - The MBMoniker to be matched.
See Also:
ManagedBean
 o doDelete
 public synchronized void doDelete()
Deletes the currently selected ManagedBeans from this RepositoryModel. All registered ModelChange listeners are informed of the change.

See Also:
ManagedBean
 o doAdd
 public synchronized void doAdd(ManagedBean m[])
Adds an array of ManagedBeans to this RepositoryModel. All registered ModelChange listeners are informed of the change.

Parameters:
m - An array of ManagedBeans to add to this RepositoryModel.
See Also:
ManagedBean
 o doAdd
 public synchronized void doAdd(ManagedBean m)
Adds a ManagedBean to the RepositoryModel. All registered ModelChange listeners are informed of the change.

Parameters:
m - The ManagedBean to add to this RepositoryModel.
See Also:
ManagedBean
 o rawAdd
 protected synchronized void rawAdd(ManagedBean m)
Adds a ManagedBean to this RepositoryModel. No registered ModelChange listeners are informed, nor is the manifest updated.

Parameters:
m - The ManagedBean to add to this RepositoryModel.
See Also:
ManagedBean
 o doOpen
 public abstract void doOpen() throws FileNotFoundException, InstantiationException, IllegalAccessException, InstantiationError, IOException
Opens the DirectoryRepository. It determines what 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 IO problem occurs while reading the RepositoryModel.
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.
See Also:
JarRepositoryModel, DirectoryRepositoryModel
 o doClose
 public abstract void doClose() throws IOException
Closes the RepositoryModel. If the RepositoryModel was opened in WRITE_ONLY mode, the repository will be written to the location specified by getRepositoryName().

Throws: IOException
Thrown if an IO problem occurs while writing the RepositoryModel.
 o reconstituteManagedBean
 public abstract boolean reconstituteManagedBean(ManagedBean mb) throws IOException
Re-loads the MBElement data of the specified ManagedBean from this RepositoryModel. Use this method after the 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.
 o doGetManagedBeans
 public synchronized ManagedBean[] doGetManagedBeans()
Gets an array of the currently selected ManagedBeans in this RepositoryModel.

Returns:
An array of the currently selected ManagedBeans in this RepositoryModel.
See Also:
ManagedBean
 o getAllManagedBeans
 public synchronized ManagedBean[] getAllManagedBeans()
Gets an array of all of the ManagedBeans in this RepositoryModel.

Returns:
An array of the currently selected ManagedBeans in this RepositoryModel.
See Also:
ManagedBean
 o getIsEmpty
 public synchronized boolean getIsEmpty()
Determines whether this RepositoryModel is empty.

Returns:
true if the RepositoryModel is empty; false otherwise.
 o getListOfSupportedElementTypes
 public Class[] getListOfSupportedElementTypes()
Gets a list of the MBElement types supported by this RepositoryModel.

Returns:
A list of the supported MBElement types.
See Also:
MBElement
 o getRepositoryModelMode
 public int getRepositoryModelMode()
Gets the mode of the RepositoryModel.

Returns:
The mode of the RepositoryModel. Valid modes are READ_ONLY, WRITE_ONLY, or READ_WRITE.
 o setRepositoryModelMode
 protected synchronized void setRepositoryModelMode(int m)
Sets the mode of the RepositoryModel.

Parameters:
m - The mode of the RepositoryModel. Valid modes are READ_ONLY, WRITE_ONLY, or READ_WRITE.
 o fetchByteArrayForElement
 public synchronized byte[] fetchByteArrayForElement(MBMoniker m,
                                                     Class c) throws ClassNotFoundException
Gets the ByteArray for the MBElement that matches the given <moniker, class> pair.

Parameters:
m - The MBMoniker to be matched.
c - The Class to be matched.
Returns:
The ByteArray associated with the MBElement that matches the <moniker, class> pair. Returns null if no match can be found.
Throws: ClassNotFoundException
Thrown if the MBElement class cannot be found.
See Also:
MBMoniker, MBElement
 o testMonikerForElement
 public synchronized boolean testMonikerForElement(MBMoniker m)
Searches the RepositoryModel for an MBElement with the specified MBMoniker.

Parameters:
m - The MBMoniker to find.
Returns:
true if found; false otherwise.
See Also:
MBMoniker, ManagedBean, MBElement
 o setRepositoryModelName
 public synchronized void setRepositoryModelName(String name)
Sets the name of this RepositoryModel.

Parameters:
name - The name.
 o getRepositoryModelName
 public String getRepositoryModelName()
Gets the name of this RepositoryModel.

Returns:
The RepositoryModel name.
 o setRepositoryModelURL
 public synchronized void setRepositoryModelURL(URL url)
Sets the URL of this RepositoryModel.

Parameters:
url - The URL.
 o getRepositoryModelURL
 public URL getRepositoryModelURL()
Gets the URL of this RepositoryModel.

Returns:
The RepositoryModel URL.
 o getFixedFilename
 public String getFixedFilename(String filename)
Fixes the file name part returned from the URL method getFile(). This method resolves problems that can occur when a drive letter is present in the file name.

Parameters:
filename - The file name to be fixed.
Returns:
The fixed file name.
 o setClassAccess
 public synchronized void setClassAccess(Class c)
Sets the Class of this RepositoryModel.

Parameters:
c - The Class used to access this RepositoryModel.
 o getClassAccess
 public Class getClassAccess()
Gets the Class of this RepositoryModel.

Returns:
The Class used to access this RepositoryModel.
 o setReferenceCount
 public synchronized void setReferenceCount(int c)
Sets the reference count for this RepositoryModel.

Parameters:
c - The reference count value.
 o getReferenceCount
 public int getReferenceCount()
Gets the reference count for this RepositoryModel.

Returns:
The current reference count.
 o addRepositoryModelChangeListener
 public void addRepositoryModelChangeListener(RepositoryModelChangeListener l)
Adds a listener to the list.

Parameters:
l - The listener to add.
 o removeRepositoryModelChangeListener
 public void removeRepositoryModelChangeListener(RepositoryModelChangeListener l)
Removes a listener from the list.

Parameters:
l - The listener to remove.
 o fireRepositoryModelChangeEvent
 protected void fireRepositoryModelChangeEvent(RepositoryModelChangeEvent e)
Distributes the event parameter to all registered listeners.

Parameters:
e - The event being distributed.
 o addRepositorySelectionChangeListener
 public void addRepositorySelectionChangeListener(RepositorySelectionChangeListener l)
Adds a listener to the list.

Parameters:
l - The listener to add.
 o removeRepositorySelectionChangeListener
 public void removeRepositorySelectionChangeListener(RepositorySelectionChangeListener l)
Removes a listener from the list.

Parameters:
l - The listener to remove.
 o fireRepositorySelectionChangeEvent
 protected void fireRepositorySelectionChangeEvent(RepositorySelectionChangeEvent e)
Distributes the event parameter to all registered listeners.

Parameters:
e - The event being distributed.
 o getManagedBeans
 protected Vector getManagedBeans()
Gets a Vector of the ManagedBeans in this RepositoryModel.

Returns:
A Vector of the ManagedBeans in this RepositoryModel.
See Also:
ManagedBean
 o setManagedBeans
 protected void setManagedBeans(Vector mbv)
Sets the Vector of ManagedBeans in this RepositoryModel.

Parameters:
mbv - The Vector of ManagedBeans to be set in this RepositoryModel.
See Also:
ManagedBean
 o getSelectedManagedBeans
 public synchronized Vector getSelectedManagedBeans()
Gets a Vector of the currently selected ManagedBeans in this RepositoryModel.

Returns:
A Vector of the currently selected ManagedBeans in this RepositoryModel.
See Also:
ManagedBean
 o setSelectedManagedBeans
 protected synchronized void setSelectedManagedBeans(Vector mbv)
Sets the Vector of currently selected ManagedBeans in this RepositoryModel.

Parameters:
mbv - The Vector of selected ManagedBeans to be set in this RepositoryModel.
See Also:
ManagedBean
 o getMBManifest
 protected synchronized MBManifest getMBManifest()
Gets the MBManifest of this RepositoryModel.

Returns:
The MBManifest of this RepositoryModel.
See Also:
MBManifest
 o setMBManifest
 protected synchronized void setMBManifest(MBManifest m)
Sets the MBManifest of this RepositoryModel.

Parameters:
m - The new MBManifest.
See Also:
MBManifest
 o putRepositoryModel
 public synchronized boolean putRepositoryModel()
Writes the ByteArray representations of all of the MBElements in all of the ManagedBeans in this RepositoryModel to the working directory.

Returns:
true if write was successful; false otherise.
 o updateDigests
 protected synchronized void updateDigests()
Adds new SHA-1 and MD5 MessageDigest information to the manifest for this RepositoryModel. This method is called immediately before writing a manifest.

See Also:
MessageDigest
 o reconstituteRepositoryModel
 protected synchronized boolean reconstituteRepositoryModel()
Re-reads all of the MBElement ByteArray information into each MBElement in each ManagedBean in the RepositoryModel.

Returns:
true if successful; false otherwise.
 o buildMBManifest
 protected synchronized MBManifest buildMBManifest()
Builds a manifest for this RepositoryModel. The manifest style is determined by setManifestStyle().

 o registerManagedBeanFactory
 public synchronized void registerManagedBeanFactory(ManagedBeanFactory mbf)
Registers a ManagedBeanFactory object with this RepositoryModel. The registered ManagedBeanFactory will from this point on be returned from getManagedBeanFactory().

Parameters:
mbf - The ManagedBeanFactory object that is being registered. If mbf is null, the default ManagedBeanFactory will be used.
See Also:
ManagedBeanFactory, ManagedBean
 o getManagedBeanFactory
 public synchronized ManagedBeanFactory getManagedBeanFactory()
Gets the registered ManagedBeanFactory or the default ManagedBeanFactory if none is registered.

Returns:
The ManagedBeanFactory used when creating ManagedBeans.
See Also:
ManagedBeanFactory, ManagedBean
 o registerMBElementFactory
 public synchronized void registerMBElementFactory(MBElementFactory mbef)
Registers an MBElementFactory object with this ManagedBean. The registered MBElementFactory will from this point on be returned from getMBElementFactory().

Parameters:
mbef - The MBElementFactory object that is being registered. If mbef is null, the default MBElementFactory will be used.
See Also:
MBElementFactory, MBElement
 o getMBElementFactory
 public synchronized MBElementFactory getMBElementFactory()
Gets the registered MBElementFactory or the default MBElementFactory if none is registered.

Returns:
The MBElementFactory used when creating MBElements.
See Also:
MBElementFactory, MBElement
 o setPolicy
 public int setPolicy(int policy)
Sets the RepositoryModel policy.

Parameters:
policy - ENHANCED_SPEC (default) or STRICT_SPEC.
Returns:
The previous policy.
 o getPolicy
 public int getPolicy()
Gets the RepositoryModel policy.

Returns:
The current policy: ENHANCED_SPEC (default) or STRICT_SPEC.
 o setManifestStyle
 public int setManifestStyle(int style)
Sets the Manifest style for this RepositoryModel.

Parameters:
style - ENHANCED_MANIFEST, JAVASOFT_MANIFEST, or a combination of the two. Default is ENHANCED_MANIFEST | JAVASOFT_MANIFEST.
Returns:
The previous Manifest style.
 o getManifestStyle
 public int getManifestStyle()
Gets the Manifest style for this RepositoryModel.

Returns:
The current style: ENHANCED_MANIFEST, JAVASOFT_MANIFEST, or a combination of the two.
 o makeBeanName
 protected String makeBeanName(String moniker)
Generates a bean name from a moniker

Parameters:
moniker - Input moniker.
Returns:
The bean name.
 o addToDeleteList
 protected void addToDeleteList(MBElement mbe)
Adds the MBElement parameter to a list of MBElements that have been deleted from this RepositoryModel. This method is for use only by persons who are writing custom RepositoryModels.

Parameters:
mbe - MBElement to be added to the list of deleted elements.
 o getDeleteList
 protected Vector getDeleteList()
Gets the list of deleted MBElements. This method is for use only by persons who are writing custom RepositoryModels.

Returns:
A Vector containing the deleted MBElements.
 o makeElementName
 protected String makeElementName(String moniker)
Generates an element name from a moniker

Parameters:
moniker - Input moniker.
Returns:
The element name.
 o dumpRepository
 public synchronized void dumpRepository()
Dumps the RepositoryModel MBManifest and all of its ManagedBeans.


All Packages  Class Hierarchy  This Package  Previous  Next  Index