|
Java AFS Admin API v1.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openafs.jafsadm.Volume
An abstract representation of an AFS volume. It holds information about
the server, such as what its quota is.
Constructing an instance of a Volume
does not mean an actual
AFS partition is created on a partition -- usually a Volume
object is a representation of an already existing AFS volume. If,
however, the Volume
is constructed with the name of a
volume that does not exist in the cell to which the provided
Partition
belongs, a new AFS volume with that name can be
created on that partition by calling the create(int)
method. If
such a volume does already exist when this method is called, an exception
will be thrown.
The following is a simple example of how to construct and use a
Volume
object. This example obtains the list of
Volume
objects residing on a particular partition, and prints
out the name and id of each one.
import org.openafs.jafsadm.Cell; import org.openafs.jafsadm.AFSAdminException; import org.openafs.jafsadm.Partition; import org.openafs.jafsadm.Server; import org.openafs.jafsadm.Volume; ... public class ... { ... private Cell cell; private Server server; private Partition partition; ... public static void main(String[] args) throws Exception { String username = arg[0]; String password = arg[1]; String cellName = arg[2]; String serverName = arg[3]; String partitionName = arg[4]; cell = new Cell(cellName, username, password); server = cell.getServer(serverName); partition = cell.getPartition(partitionName); System.out.println("Volumes in Partition " + partition.getName() + ":"); Volume[] volumes = partition.getVolumes(); for (int i = 0; i < volumes.length; i++) { System.out.println(" -> " + volumes[i] + ": " + volumes[i].getID()); } } ... }
Field Summary | |
static int |
VOLUME_BUSY
Status/disposition busy |
static int |
VOLUME_DISK_FULL
Status/disposition disk full |
static int |
VOLUME_MOVED
Status/disposition moved |
static int |
VOLUME_NO_SERVICE
Status/disposition no service |
static int |
VOLUME_NO_VNODE
Status/disposition no vnode |
static int |
VOLUME_NO_VOL
Status/disposition no volume |
static int |
VOLUME_OFFLINE
Status/disposition offline |
static int |
VOLUME_OK
Status/disposition ok |
static int |
VOLUME_ONLINE
Status/disposition online |
static int |
VOLUME_OVER_QUOTA
Status/disposition over quota |
static int |
VOLUME_SALVAGE
Status/disposition salvage |
static int |
VOLUME_TYPE_BACKUP
Backup volume type |
static int |
VOLUME_TYPE_READ_ONLY
Read-only volume type |
static int |
VOLUME_TYPE_READ_WRITE
Read-write volume type |
static int |
VOLUME_VOL_EXISTS
Status/disposition volume exists |
Constructor Summary | |
Volume(String name,
Partition partition)
Constructs a new Volume object instance given the name of
the AFS volume and the AFS cell, represented by partition ,
to which it belongs. |
|
Volume(String name,
Partition partition,
boolean preloadAllMembers)
Constructs a new Volume object instance given the name of
the AFS volume and the AFS partition, represented by
partition , to which it belongs. |
Method Summary | |
int |
compareTo(Object obj)
Comparable interface method. |
int |
compareTo(Volume volume)
Compares two Volume objects respective to their names and does not factor any other attribute. |
void |
create(int quota)
Creates a new volume on the server and partition given upon construction. |
Volume |
createBackup()
Creates a backup volume for this volume. |
void |
createMountPoint(String directory)
Creates a read-write mount point for this volume. |
void |
createMountPoint(String directory,
boolean readWrite)
Creates a mount point for this volume. |
Volume |
createReadOnly(Partition sitePartition)
Creates a readonly site for this volume on the specified server and partition. |
void |
delete()
Deletes the volume from the cell. |
void |
dump(String fileName)
Dumps this volume to a file. |
void |
dump(String fileName,
GregorianCalendar dumpSince)
Dumps this volume to a file. |
boolean |
equals(Volume otherVolume)
Tests whether two Volume objects are equal, based on their
names and hosting partition. |
int |
getAccessesSinceMidnight()
Returns the number of accesses since midnight. |
int |
getBackupID()
Returns the backup ID of this volume |
GregorianCalendar |
getCopyCreationDate()
Returns the date the volume was copied. |
GregorianCalendar |
getCreationDate()
Returns the date the volume was created |
int |
getCurrentSize()
Returns current volume size in K. |
int |
getDisposition()
Returns volume disposition. |
int |
getFileCount()
Returns file count. |
int |
getID()
Returns the id of this volume. |
GregorianCalendar |
getLastUpdateDate()
Returns the date the volume was last updated. |
String |
getName()
Returns the name of this volume. |
Partition |
getPartition()
Returns this volume's hosting partition. |
int |
getQuota()
Returns this volume's quota, expressed in kilobyte blocks (1024 kilobyte blocks equal one megabyte). |
int |
getReadOnlyID()
Returns the read-only ID of this volume |
int |
getReadWriteID()
Returns the read-write ID of this volume |
int |
getStatus()
Returns volume status. |
int |
getTotalFreeSpace()
Returns the difference between quota and current volume size (in K). |
int |
getType()
Returns volume type. |
boolean |
isQuotaUnlimited()
Tests whether this volume's quota is configured as unlimited. |
void |
lock()
Locks the VLDB enrty for this volume |
void |
mount()
Mounts this volume, bringing it online and making it accessible. |
void |
moveTo(Partition newPartition)
Moves this volume to the specified partition (which indirectly specifies a new server, as well). |
void |
refresh()
Refreshes the properties of this Volume object instance with values from the AFS volume it represents. |
void |
release()
Releases this volume, which updates the read-only copies of it. |
void |
release(boolean forceComplete)
Releases this volume, which updates the read-only copies of it. |
void |
rename(String newName)
Renames this volume. |
void |
restore(String fileName,
boolean incremental)
Restores a file to this volume. |
void |
restore(String fileName,
boolean incremental,
int id)
Restores a file to this volume. |
void |
salvage()
Salvages (restores consistency to) this volume. |
void |
setQuota(int quota)
Sets quota of volume. |
String |
toString()
Returns the name of this Volume |
void |
unlock()
Unlocks the VLDB entry for this volume |
void |
unmount()
Unmounts this volume, bringing it offline and making it inaccessible. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int VOLUME_TYPE_READ_WRITE
public static final int VOLUME_TYPE_READ_ONLY
public static final int VOLUME_TYPE_BACKUP
public static final int VOLUME_OK
public static final int VOLUME_SALVAGE
public static final int VOLUME_NO_VNODE
public static final int VOLUME_NO_VOL
public static final int VOLUME_VOL_EXISTS
public static final int VOLUME_NO_SERVICE
public static final int VOLUME_OFFLINE
public static final int VOLUME_ONLINE
public static final int VOLUME_DISK_FULL
public static final int VOLUME_OVER_QUOTA
public static final int VOLUME_BUSY
public static final int VOLUME_MOVED
Constructor Detail |
public Volume(String name, Partition partition) throws AFSAdminException
Volume
object instance given the name of
the AFS volume and the AFS cell, represented by partition
,
to which it belongs. This does not actually
create a new AFS volume, it just represents one.
If name
is not an actual AFS volume, exceptions
will be thrown during subsequent method invocations on this
object, unless the create(int)
method is explicitly called
to create it.name
- the name of the volume to representpartition
- the partition on which the volume residesAFSAdminException
- If an error occurs in the native codepublic Volume(String name, Partition partition, boolean preloadAllMembers) throws AFSAdminException
Volume
object instance given the name of
the AFS volume and the AFS partition, represented by
partition
, to which it belongs. This does not actually
create a new AFS volume, it just represents one.
If name
is not an actual AFS volume, exceptions
will be thrown during subsequent method invocations on this
object, unless the create(int)
method is explicitly called
to create it. Note that if the volume doesn't exist and
preloadAllMembers
is true, an exception will be thrown.
This constructor is ideal for point-in-time representation and
transient applications. It ensures all data member values are set
and available without calling back to the filesystem at the first request
for them. Use the refresh()
method to address any coherency
concerns.
name
- the name of the volume to representpartition
- the partition on which the volume resides.preloadAllMembers
- true will ensure all object members are set
upon construction; otherwise members will be
set upon access, which is the default behavior.AFSAdminException
- If an error occurs in the native coderefresh()
Method Detail |
public void refresh() throws AFSAdminException
Since in most environments administrative changes can be administered from an AFS command-line program or an alternate GUI application, this method provides a means to refresh the Java object representation and thereby ascertain any possible modifications that may have been made from such alternate administrative programs. Using this method before an associated instance accessor will ensure the highest level of representative accuracy, accommodating changes made external to the Java application space. If administrative changes to the underlying AFS system are only allowed via this API, then the use of this method is unnecessary.
AFSAdminException
- If an error occurs in the native codepublic void create(int quota) throws AFSAdminException
quota
- the quota for the volume in K, 0 indicates an unlimited
quotaAFSAdminException
- If an error occurs in the native codepublic Volume createBackup() throws AFSAdminException
Volume
object representation for the
backup volume that was createdAFSAdminException
- If an error occurs in the native codepublic Volume createReadOnly(Partition sitePartition) throws AFSAdminException
sitePartition
- the partition on which the readonly volume is
to resideVolume
representation for the
read-only volume that was createdAFSAdminException
- If an error occurs in the native codepublic void delete() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic void release() throws AFSAdminException
This method will force a complete release; a complete release updates all read-only sites even if the VLDB entry has a flag.
AFSAdminException
- If an error occurs in the native codepublic void release(boolean forceComplete) throws AFSAdminException
forceComplete
- whether or not to force a complete release;
a complete release updates all read-only sites
even if the VLDB entry has a flagAFSAdminException
- If an error occurs in the native codepublic void dump(String fileName, GregorianCalendar dumpSince) throws AFSAdminException
null
for a full dump.fileName
- the path name of the file on the client machine to
which to dump this volumedumpSince
- dump only files that have been modified more recently
than this dateAFSAdminException
- If an error occurs in the native codepublic void dump(String fileName) throws AFSAdminException
fileName
- the path name of the file to which to dump this volumeAFSAdminException
- If an error occurs in the native codepublic void restore(String fileName, boolean incremental) throws AFSAdminException
Volume
as a volume that doesn't yet exist and then restore
a file to it. Or you can restore over an existing volume. If a new
volume is being created with this method, the id will be automatically
assigned.fileName
- the path name of the file on the client machine from
which to restore this volumeincremental
- if true, restores an incremental dump over an
existing volumeAFSAdminException
- If an error occurs in the native codepublic void restore(String fileName, boolean incremental, int id) throws AFSAdminException
Volume
as a volume that doesn't yet exist and then restore
a file to it. Or you can restore over an existing volume.fileName
- the path name of the file on the client machine from
which to restore this volumeincremental
- if true, restores an incremental dump over an
existing volumeid
- the id to assign this volumeAFSAdminException
- If an error occurs in the native codepublic void mount() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic void unmount() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic void lock() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic void unlock() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic void moveTo(Partition newPartition) throws AFSAdminException
newPartition
- the partition to which to move the volumeAFSAdminException
- If an error occurs in the native codepublic void rename(String newName) throws AFSAdminException
newName
- the new name for this volumeAFSAdminException
- If an error occurs in the native codepublic void salvage() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic void createMountPoint(String directory) throws AFSAdminException
directory
- the name of the directory where this volume
should be mountedAFSAdminException
- If an error occurs in the native codepublic void createMountPoint(String directory, boolean readWrite) throws AFSAdminException
directory
- the name of the directory where this volume should be
mountedreadWrite
- whether or not this mount point should be read-writeAFSAdminException
- If an error occurs in the native codepublic String getName()
public Partition getPartition()
public int getID() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic int getReadWriteID() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic int getReadOnlyID() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic int getBackupID() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic GregorianCalendar getCreationDate() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic GregorianCalendar getLastUpdateDate() throws AFSAdminException
refresh()
method is called and a more current
value is obtained.AFSAdminException
- If an error occurs in the native codepublic GregorianCalendar getCopyCreationDate() throws AFSAdminException
refresh()
method is called and a more current
value is obtained.AFSAdminException
- If an error occurs in the native codepublic int getAccessesSinceMidnight() throws AFSAdminException
refresh()
method is called and a more current
value is obtained.AFSAdminException
- If an error occurs in the native codepublic int getFileCount() throws AFSAdminException
refresh()
method is called and a more current
value is obtained.AFSAdminException
- If an error occurs in the native codepublic int getCurrentSize() throws AFSAdminException
refresh()
method is called and a more current
value is obtained.AFSAdminException
- If an error occurs in the native codepublic int getTotalFreeSpace() throws AFSAdminException
Please note: the product of this method is not saved.
AFSAdminException
- If an error occurs in the native codepublic int getQuota() throws AFSAdminException
refresh()
method is called and a more current
value is obtained.
Note: A quota value of zero, "0", grants an unlimited quota
in AFS. Consequently, to avoid delusion this method will throw an
AFSAdminException
if the returning value is zero.
AFSAdminException
- If an error occurs in the native code or
this volume's quota is configured as
unlimited.isQuotaUnlimited()
public boolean isQuotaUnlimited() throws AFSAdminException
After this method is called once, it saves the value and returns
that value on subsequent calls, until the refresh()
method is called and a more current value is obtained.
true
if this volume's quota is configured as
unlimited; otherwise false
.AFSAdminException
- If an error occurs in the native codegetQuota()
public int getStatus() throws AFSAdminException
VOLUME_OK
VOLUME_SALVAGE
VOLUME_NO_VNODE
VOLUME_NO_VOL
VOLUME_VOL_EXISTS
VOLUME_NO_SERVICE
VOLUME_OFFLINE
VOLUME_ONLINE
VOLUME_DISK_FULL
VOLUME_OVER_QUOTA
VOLUME_BUSY
VOLUME_MOVED
refresh()
method is called and a more current
value is obtained.AFSAdminException
- If an error occurs in the native codepublic int getDisposition() throws AFSAdminException
VOLUME_OK
VOLUME_SALVAGE
VOLUME_NO_VNODE
VOLUME_NO_VOL
VOLUME_VOL_EXISTS
VOLUME_NO_SERVICE
VOLUME_OFFLINE
VOLUME_ONLINE
VOLUME_DISK_FULL
VOLUME_OVER_QUOTA
VOLUME_BUSY
VOLUME_MOVED
refresh()
method is called and a more current
value is obtained.AFSAdminException
- If an error occurs in the native codepublic int getType() throws AFSAdminException
AFSAdminException
- If an error occurs in the native codepublic void setQuota(int quota) throws AFSAdminException
quota
- the new volume quota in K (0 for unlimited)AFSAdminException
- If an error occurs in the native codepublic int compareTo(Volume volume)
volume
- The Volume object to be compared to this Volume
instancepublic int compareTo(Object obj)
compareTo
in interface Comparable
compareTo(Volume)
public boolean equals(Volume otherVolume)
Volume
objects are equal, based on their
names and hosting partition.otherVolume
- the Volume to testpublic String toString()
Volume
toString
in class Object
Volume
|
Java AFS Admin (jafsadm) API for OpenAFS | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |