java.lang.Object | ||
↳ | java.util.Observable | |
↳ | com.microstrategy.utils.FileDispenser |
FileDispenser is a utility that locates a user customizable file. If the file is unavailable in a specified path, it will be duplicated from a defined resource. The class also extends the java.util.Observable class to notify Observers when a new file path is dispensed.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FileDispenser(String originalResourcePath)
This constructor takes in the location of the
resource used to duplicate the dispensed
files.
| |||||||||||
FileDispenser()
This constructor assumes that the original resource
used to make the duplicates has the same file name
as the one used in
setOriginalResourcePath(String) . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized void |
dispense(String path)
If the specified file is not found, a duplicate is made
from a master copy residing in the classpath.
| ||||||||||
synchronized String |
getDirectory()
Returns the canonical directory of the current file path.
| ||||||||||
synchronized String |
getFilePath()
Location of the file.
| ||||||||||
synchronized String |
getOriginalResourcePath()
Returns the location of the master copy.
| ||||||||||
synchronized void |
setOriginalResourcePath(String path)
Sets the path of the master copy.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
This constructor takes in the location of the resource used to duplicate the dispensed files.
originalResourcePath | Location of the master copy. |
---|
MissingResourceException | Thrown if the resource could not be found. |
---|
This constructor assumes that the original resource
used to make the duplicates has the same file name
as the one used in
setOriginalResourcePath(String)
.
If the specified file is not found, a duplicate is made from a master copy residing in the classpath. If no master copy is specified, the file name as given in the path is used for the master copy lookup. This method notifies its observers.
path | The path of the customizable/duplicated file. |
---|
IllegalArgumentException | Thrown if path is empty. |
---|---|
IOException | Thrown if a problem occurs duplicating the file. |
MissingResourceException | Thrown if the master copy could not be found during duplication. |
Returns the canonical directory of the current file path. Returns null if the file path isn't defined.
Location of the file. This returns the path that was set verbatim, or null if undefined.
Returns the location of the master copy. This will return null if not previously set.
Sets the path of the master copy.
path | Location of the master copy. |
---|
MissingResourceException | Thrown if the resource cannot be found. |
---|