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
-
ENHANCED_MANIFEST
- The output Manifest file will use IBM BeanExtender Enhanced
Manifest tags.
-
ENHANCED_SPEC
- If there is no Manifest file, the RepositoryModel will be populated
using heuristics to determine which MBElements are Beans, BeanInfos,
Customizers, etc.
-
JAVASOFT_MANIFEST
- The output Manifest file will use JavaSoft Manifest tags.
-
READ_ONLY
- Indicates that the RepositoryModel is read-only.
-
READ_WRITE
- Indicates that the RepositoryModel is read-write.
-
STRICT_SPEC
- The RepositoryModel will be populated strictly according to the
JavaBeans spec.
-
WRITE_ONLY
- Indicates that the RepositoryModel is write-only.
-
RepositoryModel(URL, int)
- Constructs base RepositoryModel function.
-
addRepositoryModelChangeListener(RepositoryModelChangeListener)
- Adds a listener to the list.
-
addRepositorySelectionChangeListener(RepositorySelectionChangeListener)
- Adds a listener to the list.
-
addToDeleteList(MBElement)
-
Adds the MBElement parameter to a list of MBElements that
have been deleted from this RepositoryModel.
-
buildMBManifest()
- Builds a manifest for this RepositoryModel.
-
doAdd(ManagedBean)
- Adds a ManagedBean to the RepositoryModel.
-
doAdd(ManagedBean[])
- Adds an array of ManagedBeans to this RepositoryModel.
-
doClose()
- Closes the RepositoryModel.
-
doDelete()
- Deletes the currently selected ManagedBeans from
this RepositoryModel.
-
doGetManagedBeans()
- Gets an array of the currently selected
ManagedBeans in this RepositoryModel.
-
doOpen()
- Opens the DirectoryRepository.
-
dumpRepository()
-
Dumps the RepositoryModel MBManifest and all of its ManagedBeans.
-
fetchByteArrayForElement(MBMoniker, Class)
- Gets the ByteArray for the MBElement
that matches the given <moniker, class> pair.
-
fireRepositoryModelChangeEvent(RepositoryModelChangeEvent)
- Distributes the event parameter to all
registered listeners.
-
fireRepositorySelectionChangeEvent(RepositorySelectionChangeEvent)
- Distributes the event parameter to all
registered listeners.
-
getAllManagedBeans()
- Gets an array of all of the ManagedBeans in this
RepositoryModel.
-
getClassAccess()
- Gets the Class of this RepositoryModel.
-
getDeleteList()
- Gets the list of deleted MBElements.
-
getFixedFilename(String)
- Fixes the file name part returned from the URL method
getFile().
-
getIsEmpty()
- Determines whether this RepositoryModel is empty.
-
getListOfSupportedElementTypes()
- Gets a list of the MBElement
types supported by this RepositoryModel.
-
getManagedBeanFactory()
- Gets the registered ManagedBeanFactory or the default
ManagedBeanFactory if none is registered.
-
getManagedBeans()
- Gets a Vector of the ManagedBeans in this
RepositoryModel.
-
getManifestStyle()
- Gets the Manifest style for this RepositoryModel.
-
getMBElementFactory()
- Gets the registered MBElementFactory or the default
MBElementFactory if none is registered.
-
getMBManifest()
- Gets the MBManifest of this RepositoryModel.
-
getPolicy()
- Gets the RepositoryModel policy.
-
getReferenceCount()
- Gets the reference count for this RepositoryModel.
-
getRepositoryModelMode()
- Gets the mode of the RepositoryModel.
-
getRepositoryModelName()
- Gets the name of this RepositoryModel.
-
getRepositoryModelURL()
- Gets the URL of this RepositoryModel.
-
getSelectedManagedBeans()
- Gets a Vector of the currently
selected ManagedBeans in this RepositoryModel.
-
makeBeanName(String)
- Generates a bean name from a moniker
-
makeElementName(String)
- Generates an element name from a moniker
-
putRepositoryModel()
- Writes the ByteArray representations of all of
the MBElements in all of the ManagedBeans in this RepositoryModel
to the working directory.
-
rawAdd(ManagedBean)
- Adds a ManagedBean to this RepositoryModel.
-
reconstituteManagedBean(ManagedBean)
- Re-loads the MBElement data of the specified ManagedBean
from this RepositoryModel.
-
reconstituteRepositoryModel()
- Re-reads all of the MBElement ByteArray
information into each MBElement in each ManagedBean in the
RepositoryModel.
-
registerManagedBeanFactory(ManagedBeanFactory)
- Registers a ManagedBeanFactory object with this RepositoryModel.
-
registerMBElementFactory(MBElementFactory)
- Registers an MBElementFactory object with this ManagedBean.
-
removeRepositoryModelChangeListener(RepositoryModelChangeListener)
- Removes a listener from the list.
-
removeRepositorySelectionChangeListener(RepositorySelectionChangeListener)
- Removes a listener from the list.
-
selectAll()
- Selects all of the ManagedBeans in this
RepositoryModel.
-
selectManagedBean(int)
- Selects the
ManagedBean at the specified index in this RepositoryModel.
-
selectManagedBean(ManagedBean)
- Selects the ManagedBean argument in this RepositoryModel.
-
selectManagedBean(MBMoniker)
- Selects the ManagedBeans in this RepositoryModel whose moniker
matches mbMoniker.
-
selectNone()
- If any ManagedBeans are selected, this method deselects them.
-
setClassAccess(Class)
- Sets the Class of this RepositoryModel.
-
setManagedBeans(Vector)
- Sets the Vector of ManagedBeans in this
RepositoryModel.
-
setManifestStyle(int)
- Sets the Manifest style for this RepositoryModel.
-
setMBManifest(MBManifest)
- Sets the MBManifest of this RepositoryModel.
-
setPolicy(int)
- Sets the RepositoryModel policy.
-
setReferenceCount(int)
- Sets the reference count for this RepositoryModel.
-
setRepositoryModelMode(int)
- Sets the mode of the RepositoryModel.
-
setRepositoryModelName(String)
- Sets the name of this RepositoryModel.
-
setRepositoryModelURL(URL)
- Sets the URL of this RepositoryModel.
-
setSelectedManagedBeans(Vector)
- Sets the Vector of currently
selected ManagedBeans in this RepositoryModel.
-
testMonikerForElement(MBMoniker)
- Searches the RepositoryModel for an
MBElement with the specified MBMoniker.
-
updateDigests()
- Adds new SHA-1 and MD5 MessageDigest information to
the manifest for this RepositoryModel.
READ_ONLY
public static final int READ_ONLY
- Indicates that the RepositoryModel is read-only.
WRITE_ONLY
public static final int WRITE_ONLY
- Indicates that the RepositoryModel is write-only.
READ_WRITE
public static final int READ_WRITE
- Indicates that the RepositoryModel is read-write.
STRICT_SPEC
public static final int STRICT_SPEC
- The RepositoryModel will be populated strictly according to the
JavaBeans spec. STRICT_SPEC policy means:
- A ZIP file repository contains no Beans, even if it has a Manifest.
- Any Repository without a Manifest is considered a "ZIP file repository"
(ie, it contains no Beans).
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.
ENHANCED_MANIFEST
public static final int ENHANCED_MANIFEST
- The output Manifest file will use IBM BeanExtender Enhanced
Manifest tags.
JAVASOFT_MANIFEST
public static final int JAVASOFT_MANIFEST
- The output Manifest file will use JavaSoft Manifest tags.
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
selectAll
public synchronized void selectAll()
- Selects all of the ManagedBeans in this
RepositoryModel.
- See Also:
- ManagedBean
selectNone
public synchronized void selectNone()
- If any ManagedBeans are selected, this method deselects them.
- See Also:
- ManagedBean
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
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
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
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
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
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
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
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
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.
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.
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
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
getIsEmpty
public synchronized boolean getIsEmpty()
- Determines whether this RepositoryModel is empty.
- Returns:
- true if the RepositoryModel is empty; false otherwise.
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
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.
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.
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
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
setRepositoryModelName
public synchronized void setRepositoryModelName(String name)
- Sets the name of this RepositoryModel.
- Parameters:
- name - The name.
getRepositoryModelName
public String getRepositoryModelName()
- Gets the name of this RepositoryModel.
- Returns:
- The RepositoryModel name.
setRepositoryModelURL
public synchronized void setRepositoryModelURL(URL url)
- Sets the URL of this RepositoryModel.
- Parameters:
- url - The URL.
getRepositoryModelURL
public URL getRepositoryModelURL()
- Gets the URL of this RepositoryModel.
- Returns:
- The RepositoryModel URL.
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.
setClassAccess
public synchronized void setClassAccess(Class c)
- Sets the Class of this RepositoryModel.
- Parameters:
- c - The Class used to access this RepositoryModel.
getClassAccess
public Class getClassAccess()
- Gets the Class of this RepositoryModel.
- Returns:
- The Class used to access this RepositoryModel.
setReferenceCount
public synchronized void setReferenceCount(int c)
- Sets the reference count for this RepositoryModel.
- Parameters:
- c - The reference count value.
getReferenceCount
public int getReferenceCount()
- Gets the reference count for this RepositoryModel.
- Returns:
- The current reference count.
addRepositoryModelChangeListener
public void addRepositoryModelChangeListener(RepositoryModelChangeListener l)
- Adds a listener to the list.
- Parameters:
- l - The listener to add.
removeRepositoryModelChangeListener
public void removeRepositoryModelChangeListener(RepositoryModelChangeListener l)
- Removes a listener from the list.
- Parameters:
- l - The listener to remove.
fireRepositoryModelChangeEvent
protected void fireRepositoryModelChangeEvent(RepositoryModelChangeEvent e)
- Distributes the event parameter to all
registered listeners.
- Parameters:
- e - The event being distributed.
addRepositorySelectionChangeListener
public void addRepositorySelectionChangeListener(RepositorySelectionChangeListener l)
- Adds a listener to the list.
- Parameters:
- l - The listener to add.
removeRepositorySelectionChangeListener
public void removeRepositorySelectionChangeListener(RepositorySelectionChangeListener l)
- Removes a listener from the list.
- Parameters:
- l - The listener to remove.
fireRepositorySelectionChangeEvent
protected void fireRepositorySelectionChangeEvent(RepositorySelectionChangeEvent e)
- Distributes the event parameter to all
registered listeners.
- Parameters:
- e - The event being distributed.
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
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
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
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
getMBManifest
protected synchronized MBManifest getMBManifest()
- Gets the MBManifest of this RepositoryModel.
- Returns:
- The MBManifest of this RepositoryModel.
- See Also:
- MBManifest
setMBManifest
protected synchronized void setMBManifest(MBManifest m)
- Sets the MBManifest of this RepositoryModel.
- Parameters:
- m - The new MBManifest.
- See Also:
- MBManifest
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.
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
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.
buildMBManifest
protected synchronized MBManifest buildMBManifest()
- Builds a manifest for this RepositoryModel. The manifest style
is determined by setManifestStyle().
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
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
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
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
setPolicy
public int setPolicy(int policy)
- Sets the RepositoryModel policy.
- Parameters:
- policy - ENHANCED_SPEC (default) or STRICT_SPEC.
- Returns:
- The previous policy.
getPolicy
public int getPolicy()
- Gets the RepositoryModel policy.
- Returns:
- The current policy: ENHANCED_SPEC (default) or STRICT_SPEC.
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.
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.
makeBeanName
protected String makeBeanName(String moniker)
- Generates a bean name from a moniker
- Parameters:
- moniker - Input moniker.
- Returns:
- The bean name.
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.
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.
makeElementName
protected String makeElementName(String moniker)
- Generates an element name from a moniker
- Parameters:
- moniker - Input moniker.
- Returns:
- The element name.
dumpRepository
public synchronized void dumpRepository()
- Dumps the RepositoryModel MBManifest and all of its ManagedBeans.
All Packages Class Hierarchy This Package Previous Next Index