示例#1
0
 /**
  * Tests whether this partition contains a volume that has an unlimited quota configured.
  *
  * @exception AFSException If an error occurs in the native code
  * @return <CODE>true</CODE> if a contained volume's quota is configured as unlimited; otherwise
  *     <CODE>false</CODE>.
  * @see #getTotalQuota()
  * @see #getTotalQuota(boolean)
  * @see Volume#isQuotaUnlimited()
  * @see Volume#getQuota()
  * @see #refresh()
  */
 public boolean hasVolumeWithUnlimitedQuota() throws AFSException {
   if (volumes == null) refreshVolumes();
   Volume[] volumes = getVolumes();
   for (int i = 0; i < volumes.length; i++) {
     if (volumes[i].isQuotaUnlimited()) return true;
   }
   return false;
 }
示例#2
0
 /**
  * Refreshes the properties of this Partition object instance with values from the AFS partition
  * it represents. If <CODE>all</CODE> is <CODE>true</CODE> then <U>all</U> of the properties of
  * this Partition object instance will be set, or renewed, according to the values of the AFS
  * partition it represents, disregarding any previously set properties.
  *
  * <p>Thus, if <CODE>all</CODE> is <CODE>false</CODE> then properties that are currently set will
  * be refreshed and properties that are not set will remain uninitialized. See {@link #refresh()}
  * for more information.
  *
  * @param all if true set or renew all object properties; otherwise renew all set properties
  * @exception AFSException If an error occurs in the native code
  * @see #refresh()
  */
 protected void refresh(boolean all) throws AFSException {
   if (all || volumes != null) {
     refreshVolumes();
   }
   if (all || volumeNames != null) {
     refreshVolumeNames();
   }
   if (all || cachedInfo) {
     refreshInfo();
   }
 }
示例#3
0
 /**
  * Returns the total combined quota of all volumes on this partition, ignoring volumes with
  * unlimited quotas, if <CODE>
  * ignoreUnlimitedQuotas</CODE> is <CODE>true</CODE>; otherwise an {@link AFSException} is thrown
  * if a volume has an unlimited quota.
  *
  * <p>After this method is called once, it saves the value and returns that value on subsequent
  * calls, until the {@link #refresh()} method is called and a more current value is obtained.
  *
  * @exception AFSException If an error occurs while retrieving and calculating, or a volume has an
  *     unlimited quota.
  * @return the total combined quota of all volumes on this partition
  * @see #getTotalQuota()
  * @see #hasVolumeWithUnlimitedQuota()
  * @see Volume#getQuota()
  * @see #refresh()
  */
 public int getTotalQuota(boolean ignoreUnlimitedQuotas) throws AFSException {
   if (volumes == null) refreshVolumes();
   if (totalQuota == 0 || !ignoreUnlimitedQuotas) {
     Volume[] volumes = getVolumes();
     for (int i = 0; i < volumes.length; i++) {
       try {
         totalQuota += volumes[i].getQuota();
       } catch (AFSException e) {
         if (!ignoreUnlimitedQuotas) {
           totalQuota = 0;
           throw e;
         }
       }
     }
   }
   return totalQuota;
 }
示例#4
0
 /**
  * Retrieves an array containing all of the <code>Volume</code> objects associated with this
  * <code>Partition</code>, each of which is an abstract representation of an actual AFS volume of
  * the AFS partition. After this method is called once, it saves the array of <code>Volume</code>s
  * and returns that saved array on subsequent calls, until the {@link #refresh()} method is called
  * and a more current list is obtained.
  *
  * @exception AFSException If an error occurs in the native code
  * @return a <code>Volume</code> array of the <code>Volume</code> objects of the partition.
  * @see #refresh()
  */
 public Volume[] getVolumes() throws AFSException {
   if (volumes == null) refreshVolumes();
   return (Volume[]) volumes.toArray(new Volume[volumes.size()]);
 }