java-update-20051014
authorPeter Somogyi <psomogyi@gamax.hu>
Sat, 15 Oct 2005 03:12:17 +0000 (03:12 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 15 Oct 2005 03:12:17 +0000 (03:12 +0000)
FIXES 21930

update java afs classes

44 files changed:
src/JAVA/classes/.classpath [new file with mode: 0644]
src/JAVA/classes/.project [new file with mode: 0644]
src/JAVA/classes/ErrorMessages.properties
src/JAVA/classes/org/openafs/jafs/ACL.java
src/JAVA/classes/org/openafs/jafs/AFSException.java
src/JAVA/classes/org/openafs/jafs/AFSSecurityException.java
src/JAVA/classes/org/openafs/jafs/Cell.java
src/JAVA/classes/org/openafs/jafs/Group.java
src/JAVA/classes/org/openafs/jafs/Key.java
src/JAVA/classes/org/openafs/jafs/Partition.java
src/JAVA/classes/org/openafs/jafs/Process.java
src/JAVA/classes/org/openafs/jafs/Server.java
src/JAVA/classes/org/openafs/jafs/Token.java
src/JAVA/classes/org/openafs/jafs/User.java
src/JAVA/classes/org/openafs/jafs/VersionInfo.java [new file with mode: 0644]
src/JAVA/classes/org/openafs/jafs/Volume.java
src/JAVA/classes/testAFS.java [new file with mode: 0644]
src/JAVA/libjafs/ACL.c
src/JAVA/libjafs/AdminToken.c
src/JAVA/libjafs/Cell.c
src/JAVA/libjafs/ChangeLog [new file with mode: 0644]
src/JAVA/libjafs/Exceptions.h
src/JAVA/libjafs/File.c
src/JAVA/libjafs/FileInputStream.c
src/JAVA/libjafs/FileOutputStream.c
src/JAVA/libjafs/GetNativeString.c [new file with mode: 0644]
src/JAVA/libjafs/GetNativeString.h [new file with mode: 0644]
src/JAVA/libjafs/Group.c
src/JAVA/libjafs/Internal.c
src/JAVA/libjafs/Internal.h
src/JAVA/libjafs/JAFS_Version.h [new file with mode: 0644]
src/JAVA/libjafs/Key.c
src/JAVA/libjafs/Makefile.in
src/JAVA/libjafs/Partition.c
src/JAVA/libjafs/Process.c
src/JAVA/libjafs/README [new file with mode: 0644]
src/JAVA/libjafs/Server.c
src/JAVA/libjafs/User.c
src/JAVA/libjafs/UserToken.c
src/JAVA/libjafs/Version2.c [new file with mode: 0644]
src/JAVA/libjafs/VersionInfo.c [new file with mode: 0644]
src/JAVA/libjafs/Volume.c
src/cf/osconf.m4
src/libuafs/MakefileProto.LINUX.in

diff --git a/src/JAVA/classes/.classpath b/src/JAVA/classes/.classpath
new file mode 100644 (file)
index 0000000..233be1d
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path=""/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="output" path=""/>
+</classpath>
diff --git a/src/JAVA/classes/.project b/src/JAVA/classes/.project
new file mode 100644 (file)
index 0000000..c3e6b3d
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>JAVA-openafs</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
index 4821ffd..2f20124 100644 (file)
@@ -12,26 +12,6 @@ E1003 = Operation aborted
 E1004 = Operation was forced to abort
 
 #-----------------------------------------------------------
-# Internal JAFS Error Codes
-#-----------------------------------------------------------
-E1050 = Could not allocate memory.
-E1051 = Could not find specified Java class.
-E1052 = Could not find specified Java method.
-E1053 = Could not find specified Java field.
-E1054 = Invalid argument value, argument is NULL.
-E1055 = Username provided is NULL.
-E1056 = Password provided is NULL.
-E1057 = Group name provided is NULL.
-E1058 = Group owner provided is NULL.
-E1059 = Volume name provided is NULL.
-E1060 = Partition name provided is NULL.
-E1061 = Process name provided is NULL.
-E1062 = Server name provided is NULL.
-E1063 = Cell name provided is NULL.
-E1064 = Invalid path name provided, path is NULL.
-E1065 = Invalid ACL provided, string is NULL.
-
-#-----------------------------------------------------------
 # Standard UNIX Error Codes
 #-----------------------------------------------------------
 E1   = Operation not permitted
index 61e5ca2..ab81e34 100644 (file)
@@ -33,597 +33,237 @@ import java.util.StringTokenizer;
  * This class is an extension of the standard Java File class with file-based 
  * manipulation methods overridden by integrated AFS native methods.
  *
- * @version 2.2, 03/24/2003 - Added new Delta ACL functionality and changes 
- *                            from Stonehenge.
  * @version 2.0, 04/18/2001 - Completely revised class for efficiency.
  */
 
 public class ACL implements Serializable, Comparable
 {
-  private ACL.Entry[] positiveEntries;
-  private ACL.Entry[] negativeEntries;
-
-  private ACL.Entry[] positiveExpungeEntries;
-  private ACL.Entry[] negativeExpungeEntries;
-
-  /** 
-   * Path for this ACL, if null then this ACL instance is most likely a 
-   * Delta ACL.
-   */
-  private String path = null;
+   protected ACL.Entry[] positiveEntries;
+   protected ACL.Entry[] negativeEntries;
+   protected String path;
  
-  private ACL()
-  {
-  }
-  public ACL( String path ) throws AFSException
-  {
-    this( path, true );
-  }
-  public ACL( String path, boolean init ) throws AFSException
+  public ACL(String path) throws AFSException
   {
-    int numberPositiveEntries = 0;
-    int numberNegativeEntries = 0;
-    ACL.Entry aclEntry;
-    String buffer;
-
-    this.path = path;
-
-    if ( init ) {
-      StringTokenizer st = new StringTokenizer( getACLString(path), "\n\t" );
-  
-      buffer = st.nextToken();
-      numberPositiveEntries = new Integer(buffer).intValue();
-      positiveEntries = new ACL.Entry[numberPositiveEntries];
+       this(path,true);
+ }
   
-      buffer = st.nextToken();
-      numberNegativeEntries = new Integer(buffer).intValue();
-      negativeEntries = new ACL.Entry[numberNegativeEntries];
-  
-      for(int i = 0; i < numberPositiveEntries; i++)
-      {
-        aclEntry = new ACL.Entry();
-        aclEntry.setUser(st.nextToken());
-        aclEntry.setPermissions(new Integer(st.nextToken()).intValue());
-        positiveEntries[i] = aclEntry;
-      }
-  
-      for(int i = 0; i < numberNegativeEntries; i++)
-      {
-        aclEntry = new ACL.Entry();
-        aclEntry.setUser(st.nextToken());
-        aclEntry.setPermissions(new Integer(st.nextToken()).intValue());
-        negativeEntries[i] = aclEntry;
-      }
-    } else {
-      positiveEntries = new ACL.Entry[0];
-      negativeEntries = new ACL.Entry[0];
-    }
-  }
-  /**
-   * Returns the total number of ACL entries, this is the sum of positive
-   * and negative entries.
-   *
-   * @return Total number of ACL entries
-   */
+public ACL(String path, boolean init) throws AFSException {
+       int numberPositiveEntries = 0;
+       int numberNegativeEntries = 0;
+       ACL.Entry aclEntry;
+       String buffer;
+       this.path = path;
+
+       if (init) {
+
+               StringTokenizer st = new StringTokenizer(getACLString(path), "\n\t");
+
+               buffer = st.nextToken();
+               numberPositiveEntries = new Integer(buffer).intValue();
+               positiveEntries = new ACL.Entry[numberPositiveEntries];
+
+               buffer = st.nextToken();
+               numberNegativeEntries = new Integer(buffer).intValue();
+               negativeEntries = new ACL.Entry[numberNegativeEntries];
+
+               for (int i = 0; i < numberPositiveEntries; i++) {
+                       aclEntry = new ACL.Entry();
+                       aclEntry.setUser(st.nextToken());
+                       aclEntry.setPermissions(new Integer(st.nextToken()).intValue());
+                       positiveEntries[i] = aclEntry;
+               }
+
+               for (int i = 0; i < numberNegativeEntries; i++) {
+                       aclEntry = new ACL.Entry();
+                       aclEntry.setUser(st.nextToken());
+                       aclEntry.setPermissions(new Integer(st.nextToken()).intValue());
+                       negativeEntries[i] = aclEntry;
+               }
+       }else{
+               positiveEntries = new ACL.Entry[numberPositiveEntries];
+               negativeEntries = new ACL.Entry[numberNegativeEntries];
+       }
+}
   public int getEntryCount()
   {
-    return getPositiveEntryCount() + getNegativeEntryCount();
+    return positiveEntries.length + positiveEntries.length;
   }
-  /**
-   * Returns the path this ACL instance is bound to.
-   *
-   * @return Path for this ACL
-   */
   public String getPath()
   {
     return path;
   }
-  /**
-   * Writes the ACL to AFS, making all changes immediately effective.
-   * This method requires an active connection to AFS.
-   */
-  public void flush() throws AFSException
+  public void setPath(String path)
   {
-    setACLString(path, getFormattedString());
+       this.path= path;
   }
-
-
-  /*--------------------------------------------------------------------------*/
-  /* Positive ACL Methods                                                     */
-  /*--------------------------------------------------------------------------*/
-
-  /**
-   * Returns the number of positive ACL entries for this ACL instance.
-   *
-   * @return Positive ACL entry count
-   */
-  public int getPositiveEntryCount()
-  {
-    return ( positiveEntries == null ) ? 0 : positiveEntries.length;
-  }
-  /**
-   * Returns all positive ACL entries for this ACL instance.
-   *
-   * @return All positive ACL entries
-   */
   public ACL.Entry[] getPositiveEntries()
   {
-    return ( positiveEntries == null ) ? new ACL.Entry[0] : positiveEntries;
-  }
-  /**
-   * Returns the positive ACL entry associated with the specified 
-   * user/group name.
-   *
-   * @param  name Name of user/group for desired ACL entry.
-   * @return Positive ACL entry
-   * @see ACL.Entry#getUser()
-   */
-  public Entry getPositiveEntry(String name)
-  {
-    int n = getPositiveEntryCount();
-    for (int i = 0; i < n; i++) {
-      if (positiveEntries[i].getUser().equalsIgnoreCase(name)) {
-        return positiveEntries[i];
-      }
-    }
-    return null;
+    return positiveEntries;
   }
-  /**
-   * Returns all positive ACL entries to be expunged; used in Delta ACLs.
-   *
-   * @return All positive ACL entries
-   */
-  public ACL.Entry[] getPositiveExpungeEntries()
-  {
-    return ( positiveExpungeEntries == null ) ? new ACL.Entry[0] : positiveExpungeEntries;
-  }
-  /**
-   * Returns <code>true</code> if this ACL contains the specified ACL entry.
-   *
-   * @param  entry Positive ACL entry
-   * @return <code>true</code> if the specified ACL entry is present; 
-   *         <code>false</code> otherwise.
-   */
-  public boolean containsPositiveEntry(Entry entry)
-  {
-    int n = getPositiveEntryCount();
-    for (int i = 0; i < n; i++) {
-      if (positiveEntries[i].equals(entry)) {
-        return true;
-      }
-    }
-    return false;
-  }
-  /**
-   * Adds a single positive ACL entry to this ACL instance.
-   *
-   * @param entry ACL.Entry object to add
-   */
-  public void addPositiveEntry( ACL.Entry entry ) throws AFSException
+  public void addPositiveEntry(ACL.Entry entry) throws AFSException
   {
-    int n = getPositiveEntryCount();
+    int n = positiveEntries.length;
     ACL.Entry[] e = new ACL.Entry[n + 1];
-    if ( n > 0 ) System.arraycopy(positiveEntries, 0, e, 0, n);
-    e[n] = entry;
-    positiveEntries = e;
-    update();
-  }
-  /**
-   * Adds the provided list of positive ACL entries to this ACL instance.
-   *
-   * @param entries Array of ACL.Entry objects to add
-   */
-  public void addPositiveEntries( ACL.Entry[] entries ) throws AFSException
-  {
-    int n = getPositiveEntryCount();
-    ACL.Entry[] e = new ACL.Entry[n + entries.length];
     System.arraycopy(positiveEntries, 0, e, 0, n);
-    System.arraycopy(entries,0,e,n,entries.length);
+    e[n] = entry;
     positiveEntries = e;
-    update();
+    setACLString(path, getFormattedString());
   }
-  /**
-   * Sets the complete array of positive ACL entries to the provided
-   * ACL entry list (<code>entries</code>) for this ACL instance.
-   *
-   * @param entries Array of ACL.Entry objects that represent this
-   *                ACL's positive entry list.
-   */
-  public void setPositiveEntries( ACL.Entry[] entries ) throws AFSException
+  public void setPositiveEntries(ACL.Entry[] entries) throws AFSException
   {
     this.positiveEntries = entries;
-    update();
-  }
-  /**
-   * Add a positive ACL entry to the list of positive ACL entries to be 
-   * expunged; used in Delta ACLs.
-   *
-   * @param entry Positive ACL entries to be expunged.
-   */
-  public void addPositiveExpungeEntry( ACL.Entry entry ) throws AFSException
-  {
-    int n = ( positiveExpungeEntries == null ) ? 0 : positiveExpungeEntries.length;
-    ACL.Entry[] e = new ACL.Entry[n + 1];
-    if ( n > 0 ) System.arraycopy(positiveExpungeEntries, 0, e, 0, n);
-    e[n] = entry;
-    positiveExpungeEntries = e;
-    update();
-  }
-
-  /**
-   * Removes a single positive ACL entry from this ACL instance.
-   *
-   * @param entry ACL.Entry object to removed
-   */
-  public void removePositiveEntry(Entry entry) throws AFSException
-  {
-    int n = getPositiveEntryCount();
-    ArrayList list = new ArrayList();
-
-    for (int i = 0; i < n; i++) {
-      if (!positiveEntries[i].equals(entry)) {
-        list.add(positiveEntries[i]);
-      }
-    }
-
-    positiveEntries = (ACL.Entry[]) list.toArray(new ACL.Entry[list.size()]);
-    update();
-  }
-  /**
-   * Removes all positive ACL entries from this ACL instance.
-   */
-  public void removeAllPositiveEntries() throws AFSException
-  {
-    positiveEntries = new Entry[0];
-    update();
-  }
-
-
-  /*--------------------------------------------------------------------------*/
-  /* Negative ACL Methods                                                     */
-  /*--------------------------------------------------------------------------*/
-
-  /**
-   * Returns the number of negative ACL entries for this ACL instance.
-   *
-   * @return Negative ACL entry count
-   */
-  public int getNegativeEntryCount()
-  {
-    return ( negativeEntries == null ) ? 0 : negativeEntries.length;
+    setACLString(path, getFormattedString());
   }
-  /**
-   * Returns all negative ACL entries for this ACL instance.
-   *
-   * @return All negative ACL entries
-   */
   public ACL.Entry[] getNegativeEntries()
   {
-    return ( negativeEntries == null ) ? new ACL.Entry[0] : negativeEntries;
-  }
-  /**
-   * Returns the negative ACL entry associated with the specified 
-   * user/group name.
-   *
-   * @param  name Name of user/group for desired ACL entry.
-   * @return Negative ACL entry
-   * @see ACL.Entry#getUser()
-   */
-  public Entry getNegativeEntry(String name)
-  {
-    int n = getNegativeEntryCount();
-    for (int i = 0; i < n; i++) {
-      if (negativeEntries[i].getUser().equalsIgnoreCase(name)) {
-        return negativeEntries[i];
-      }
-    }
-    return null;
+    return negativeEntries;
   }
-  /**
-   * Returns all negative ACL entries to be expunged; used in Delta ACLs.
-   *
-   * @return All negative ACL entries to be expunged.
-   */
-  public ACL.Entry[] getNegativeExpungeEntries()
+  public void addNegativeEntry(ACL.Entry entry) throws AFSException
   {
-    return ( negativeExpungeEntries == null ) ? new ACL.Entry[0] : negativeExpungeEntries;
-  }
-  /**
-   * Returns <code>true</code> if this ACL contains the specified ACL entry.
-   *
-   * @param  entry Negative ACL entry
-   * @return <code>true</code> if the specified ACL entry is present; 
-   *         <code>false</code> otherwise.
-   */
-  public boolean containsNegative(Entry entry)
-  {
-    int n = getNegativeEntryCount();
-    for (int i = 0; i < n; i++) {
-      if (negativeEntries[i].equals(entry)) {
-        return true;
-      }
-    }
-    return false;
-  }
-  /**
-   * Adds a single negative ACL entry to this ACL instance.
-   *
-   * @param entry ACL.Entry object to add
-   */
-  public void addNegativeEntry( ACL.Entry entry ) throws AFSException
-  {
-    int n = getNegativeEntryCount();
+    int n = negativeEntries.length;
     ACL.Entry[] e = new ACL.Entry[n + 1];
-    if ( n > 0 ) System.arraycopy(negativeEntries, 0, e, 0, n);
+    System.arraycopy(negativeEntries, 0, e, 0, n);
     e[n] = entry;
     negativeEntries = e;
-    update();
+    setACLString(path, getFormattedString());
   }
-  /**
-   * Adds the provided list of negative ACL entries to this ACL instance.
-   *
-   * @param entries Array of ACL.Entry objects to add
-   */
-  public void addNegativeEntries( ACL.Entry[] entries ) throws AFSException
-  {
-    int n = getNegativeEntryCount();
-    ACL.Entry[] e = new ACL.Entry[n + entries.length];
-    System.arraycopy(negativeEntries, 0, e, 0, n);
-    System.arraycopy(entries,0,e,n,entries.length);
-    negativeEntries = e;
-    update();
+  
+  public void addAllNegativeEntrys(ACL.Entry[] entry) throws AFSException
+  {
+       int n = negativeEntries.length;
+       ACL.Entry[] e = new ACL.Entry[n + entry.length];
+       System.arraycopy(negativeEntries, 0, e, 0, n);
+       System.arraycopy(entry,0,e,n,entry.length);
+       
+       negativeEntries = e;
+       setACLString(path, getFormattedString());
   }
-  /**
-   * Add a negative ACL entry to the list of negative ACL entries to be 
-   * expunged; used in Delta ACLs.
-   *
-   * @param entry Negative ACL entries to be expunged.
-   */
-  public void addNegativeExpungeEntry( ACL.Entry entry ) throws AFSException
-  {
-    int n = ( negativeExpungeEntries == null ) ? 0 : negativeExpungeEntries.length;
-    ACL.Entry[] e = new ACL.Entry[n + 1];
-    if ( n > 0 ) System.arraycopy(negativeExpungeEntries, 0, e, 0, n);
-    e[n] = entry;
-    negativeExpungeEntries = e;
-    update();
+  
+  public void addAllPositiveEntrys(ACL.Entry[] entry) throws AFSException
+  {
+       int n = positiveEntries.length;
+       ACL.Entry[] e = new ACL.Entry[n + entry.length];
+       System.arraycopy(positiveEntries, 0, e, 0, n);
+       System.arraycopy(entry,0,e,n,entry.length);
+       
+       positiveEntries = e;
+       setACLString(path, getFormattedString());
+  
   }
-  /**
-   * Sets the complete array of negative ACL entries to the provided
-   * ACL entry list (<code>entries</code>) for this ACL instance.
-   *
-   * @param entries Array of ACL.Entry objects that represent this
-   *                ACL's negative entry list.
-   */
-  public void setNegativeEntries( ACL.Entry[] entries ) throws AFSException
+  public void setNegativeEntries(ACL.Entry[] entries) throws AFSException
   {
     this.negativeEntries = entries;
-    update();
+    setACLString(path, getFormattedString());
   }
 
-  /**
-   * Removes a single negative ACL entry from this ACL instance.
-   *
-   * @param entry ACL.Entry object to removed
-   */
-  public void removeNegativeEntry(Entry entry) throws AFSException
+ /**
+ * Needs a AFS Connection
+ */
+  public void flush() throws AFSException
   {
-    int n = getNegativeEntryCount();
-    ArrayList list = new ArrayList();
-        
-    for (int i = 0; i < n; i++) {
-      if (!negativeEntries[i].equals(entry)) {
-        list.add(negativeEntries[i]);
-      }
-    }
-
-    negativeEntries = (ACL.Entry[]) list.toArray(new ACL.Entry[list.size()]);
-    update();
+    setACLString(path, getFormattedString());
   }
   
   /**
-   * Removes all negative ACL entries from this ACL instance.
-   */
-  public void removeAllNegativeEntries() throws AFSException
-  {
-    negativeEntries = new Entry[0];
-    update();
+   * removes a ACL Entry from acl
+   */
+  public void removeNegativeEntry(Entry entry) throws AFSException {
+                       
+         ArrayList arr = new ArrayList();
+               
+         for (int i = 0; i < negativeEntries.length; i++) {
+                                       
+                 if(!negativeEntries[i].equals(entry)){
+                         arr.add(negativeEntries[i]);
+                 }
+         }
+         negativeEntries = (ACL.Entry[]) arr.toArray(new ACL.Entry[arr.size()]);
+       
+       setACLString(path, getFormattedString());
   }
   
-
-  /*--------------------------------------------------------------------------*/
-  /* Delta ACL Methods                                                        */
-  /*--------------------------------------------------------------------------*/
-
   /**
-   * Returns a "Delta ACL", which is an ACL that represents only the difference
-   * (delta) of two ACLs, relative to the current ACL instance by the provided
-   * ACL specified by <code>acl</code>.
-   *
-   * <P> This ACL instance represents the base or reference object while the 
-   * provided ACL (<code>acl</code>) represents the object in question. 
-   * Therefore, if the provided ACL has an entry that differs from the base ACL,
-   * then the resulting Delta ACL will contain that entry found in the provided 
-   * ACL; base ACL entries are never entered into the Delta ACL, but rather are
-   * used solely for comparison.
-   *
-   * @param acl the ACL to compare this ACL instance to
-   * @return Delta ACL by comparing this ACL instance with <code>acl</code>
+   * removes all ACL Entrys from acl
    */
-  public ACL getDeltaACL( ACL acl ) throws AFSException
-  {
-    ACL delta = new ACL();
-    int n = getPositiveEntryCount();
-    
-    ACL.Entry[] pEntries = acl.getPositiveEntries();
-    for ( int i = 0; i < pEntries.length; i++ )
-    {
-      boolean match = false;
-      for ( int j = 0; j < n; j++ )
-      {
-        if ( pEntries[i].equals( positiveEntries[j] ) ) {
-          match = true;
-          break;
-        }
-      }
-      if ( !match ) delta.addPositiveEntry( pEntries[i] );
-    }
-
-    // Check for positive entries that need to be expunged.
-    n = getPositiveEntryCount();
-    if ( n > pEntries.length ) {
-      for ( int i = 0; i < n; i++ )
-      {
-        String eu = positiveEntries[i].getUser();
-        boolean match = false;
-        for ( int j = 0; j < pEntries.length; j++ )
-        {
-          if ( eu != null && eu.equals( pEntries[j].getUser() ) ) {
-            match = true;
-            break;
-          }
-        }
-        if ( !match ) delta.addPositiveExpungeEntry( positiveEntries[i] );
-      }
-    }
-
-    n = getNegativeEntryCount();
-    ACL.Entry[] nEntries = acl.getNegativeEntries();
-    for ( int i = 0; i < nEntries.length; i++ )
-    {
-      boolean match = false;
-      for ( int j = 0; j < n; j++ )
-      {
-        if ( nEntries[i].equals( negativeEntries[j] ) ) {
-          match = true;
-          break;
-        }
-      }
-      if ( !match ) delta.addNegativeEntry( nEntries[i] );
-    }
-
-    // Check for negative entries that need to be expunged.
-    n = getNegativeEntryCount();
-    if ( n > nEntries.length ) {
-      for ( int i = 0; i < n; i++ )
-      {
-        String eu = negativeEntries[i].getUser();
-        boolean match = false;
-        for ( int j = 0; j < nEntries.length; j++ )
-        {
-          if ( eu != null && eu.equals( nEntries[j].getUser() ) ) {
-            match = true;
-            break;
-          }
-        }
-        if ( !match ) delta.addNegativeExpungeEntry( negativeEntries[i] );
-      }
-    }
-
-    return delta;
+  public void removeAllNegativeEntrys() throws AFSException {
+       negativeEntries = new Entry[0];
+       setACLString(path, getFormattedString());
   }
-
+  
   /**
-   * Updates the current ACL instance by replacing, adding, or deleting 
-   * ACL entries designated by the specified Delta ACL (<code>delta</code>).
-   *
-   * <P> If the provided Delta ACL has an entry that differs from this ACL 
-   * instance, then the ACL entry of the Delta ACL will be set.
-   *
-   * @param delta the Delta ACL to be applied to this ACL instance
+   * removes all ACL Entrys from acl
    */
-  public void update( ACL delta ) throws AFSException
-  {
-    ArrayList pos = new ArrayList( this.getPositiveEntryCount() );
-    ArrayList neg = new ArrayList( this.getNegativeEntryCount() );
-
-    ACL.Entry[] pExpungeEntries = delta.getPositiveExpungeEntries();
-    ACL.Entry[] nExpungeEntries = delta.getNegativeExpungeEntries();
-
-    ACL.Entry[] pEntries = delta.getPositiveEntries();
-    ACL.Entry[] nEntries = delta.getNegativeEntries();
-
-    // Delete positive expunge entries first
-    int n = getPositiveEntryCount();
-    for ( int i = 0; i < n; i++ )
-    {
-      boolean match = false;
-      for ( int j = 0; j < pExpungeEntries.length; j++ )
-      {
-        if ( pExpungeEntries[j].equals( positiveEntries[i] ) ) {
-          match = true;
-          break;
-        }
-      }
-      if ( !match ) pos.add( positiveEntries[i] );
-    }
-
-    // Now check for entries that need replacing
-    for ( int i = 0; i < pEntries.length; i++ )
-    {
-      boolean match = false;
-      String user = pEntries[i].getUser();
-      for ( int j = 0; j < pos.size(); j++ )
-      {
-        if ( user.equals( ((ACL.Entry)pos.get(j)).getUser() ) ) {
-          pos.set( j, pEntries[i] );
-          match = true;
-          break;
-        }
-      }
-      if ( !match ) pos.add( pEntries[i] );
-    }
-    setPositiveEntries( (ACL.Entry[])pos.toArray(new ACL.Entry[pos.size()]) );
-
-    // Delete negative expunge entries next
-    n = getNegativeEntryCount();
-    for ( int i = 0; i < n; i++ )
-    {
-      boolean match = false;
-      for ( int j = 0; j < nExpungeEntries.length; j++ )
-      {
-        if ( nExpungeEntries[j].equals( negativeEntries[i] ) ) {
-          match = true;
-          break;
-        }
-      }
-      if ( !match ) neg.add( negativeEntries[i] );
-    }
-
-    // Now check for entries that need replacing (negative)
-    for ( int i = 0; i < nEntries.length; i++ )
-    {
-      boolean match = false;
-      String user = nEntries[i].getUser();
-      for ( int j = 0; j < neg.size(); j++ )
-      {
-        if ( user.equals( ((ACL.Entry)neg.get(j)).getUser() ) ) {
-          neg.set( j, nEntries[i] );
-          match = true;
-          break;
-        }
-      }
-      if ( !match ) neg.add( nEntries[i] );
-    }
-    setNegativeEntries( (ACL.Entry[])neg.toArray(new ACL.Entry[neg.size()]) );
+  public void removeAllPositiveEntrys() throws AFSException {
+       positiveEntries = new Entry[0];
+       setACLString(path, getFormattedString());
   }
-
-
-  /*--------------------------------------------------------------------------*/
-  /* Private Methods                                                          */
-  /*--------------------------------------------------------------------------*/
-
+  
+  
+  public boolean containsNegative(Entry entry) {
+       
+       for (int i = 0; i < negativeEntries.length; i++) {
+                                       
+                        if(negativeEntries[i].equals(entry)){
+                                return true;
+                        }
+                }
+       return false;
+  }
+  
+  
+       public Entry getNegative(String entryname) {
+
+         for (int i = 0; i < negativeEntries.length; i++) {
+
+                          if(negativeEntries[i].getUser().equalsIgnoreCase(entryname)){
+                                  return negativeEntries[i];
+                          }
+                  }
+         return null;
+       }
+       
+       public Entry getPositive(String entryname) {
+
+         for (int i = 0; i < positiveEntries.length; i++) {
+
+                          if(positiveEntries[i].getUser().equalsIgnoreCase(entryname)){
+                                  return positiveEntries[i];
+                          }
+                  }
+         return null;
+       }
+  public boolean containsPositive(Entry entry) {
+       
+       for (int i = 0; i < positiveEntries.length; i++) {
+                                       
+                        if(positiveEntries[i].equals(entry)){
+                                return true;
+                        }
+                }
+       return false;
+  }
+  
   /**
-   * Returns a resized array containing only valid (non-empty) ACL entries.
-   *
-   * @param  entries Original array of entries, possibly containing empty 
-   *                 entries.
-   * @return         All non-empty ACL entries
+   * removes a ACL Entry from acl
    */
-  private ACL.Entry[] getNonEmptyEntries( ACL.Entry[] entries )
+  public void removePositiveEntry(Entry entry) throws AFSException {
+                       
+         ArrayList arr = new ArrayList();
+               
+         for (int i = 0; i < positiveEntries.length; i++) {
+                                       
+                 if(!positiveEntries[i].equals(entry)){
+                         arr.add(positiveEntries[i]);
+                 }
+         }
+         positiveEntries = (ACL.Entry[]) arr.toArray(new ACL.Entry[arr.size()]);
+       setACLString(path, getFormattedString());
+  }
+
+  private ACL.Entry[] getNonEmptyEntries(ACL.Entry[] entries)
   {
-    if ( entries == null ) return new ACL.Entry[0];
-    ArrayList list = new ArrayList( entries.length );
+    ArrayList response = new ArrayList(entries.length);
     for (int i = 0; i < entries.length; i++)
     {
       boolean isNonEmpty = entries[i].canRead()   ||
@@ -633,28 +273,23 @@ public class ACL implements Serializable, Comparable
                            entries[i].canDelete() ||
                            entries[i].canLock()   ||
                            entries[i].canAdmin();
-      if (isNonEmpty) list.add(entries[i]);
+      if (isNonEmpty) response.add(entries[i]);
     }
-    if (list.size() == entries.length) return entries;
-    return (ACL.Entry[])list.toArray(new ACL.Entry[list.size()]);
+    if (response.size() == entries.length) return entries;
+    return (ACL.Entry[])response.toArray(new ACL.Entry[response.size()]);
   }
 
-  private void entriesToString( ACL.Entry[] entries, StringBuffer buffer )
+  private void entriesToString(ACL.Entry[] entries, StringBuffer response)
   {
     for (int i = 0; i < entries.length; i++)
     {
-      this.entryToString((ACL.Entry)entries[i], buffer);
+      this.entryToString((ACL.Entry)entries[i], response);
     }
   }
 
-  private void entryToString( ACL.Entry entry, StringBuffer buffer )
-  {
-    buffer.append(entry.getUser() + '\t' + entry.getPermissionsMask() + '\n');
-  }
-
-  private void update() throws AFSException
+  private void entryToString(ACL.Entry entry, StringBuffer response)
   {
-    if ( path != null ) setACLString(path, getFormattedString());
+    response.append(entry.getUser() + '\t' + entry.getPermissionsMask() + '\n');
   }
 
   /**
@@ -677,10 +312,7 @@ public class ACL implements Serializable, Comparable
     return out.toString();
   }
 
-
-  /*--------------------------------------------------------------------------*/
-  /* Custom Override Methods                                                  */
-  /*--------------------------------------------------------------------------*/
+  /////////////// custom override methods ////////////////////
 
   /**
    * Compares two ACL objects respective to their paths and does not
@@ -735,14 +367,9 @@ public class ACL implements Serializable, Comparable
     ACL.Entry[] nonEmptyPos = this.getNonEmptyEntries(this.getPositiveEntries());
     ACL.Entry[] nonEmptyNeg = this.getNonEmptyEntries(this.getNegativeEntries());
 
-    StringBuffer out = new StringBuffer();
-    if ( path == null ) {
-      out.append("Delta ACL\n");
-    } else {
-      out.append("ACL for ");
-      out.append(path);
-      out.append("\n");
-    }
+    StringBuffer out = new StringBuffer("ACL for ");
+    out.append(path);
+    out.append("\n");
     out.append("Positive Entries:\n");
     for (int i = 0; i < nonEmptyPos.length; i++) {
       out.append("  ");
@@ -756,33 +383,10 @@ public class ACL implements Serializable, Comparable
       }
     }
 
-    // Check to see if this is a Delta ACL
-    if ( path == null ) {
-      nonEmptyPos = this.getNonEmptyEntries(this.getPositiveExpungeEntries());
-      nonEmptyNeg = this.getNonEmptyEntries(this.getNegativeExpungeEntries());
-
-      if (nonEmptyPos.length > 0) {
-        out.append("Positive Entries to Delete:\n");
-        for (int i = 0; i < nonEmptyPos.length; i++) {
-          out.append("  ");
-          out.append(nonEmptyPos[i].toString());
-        }
-      }
-      if (nonEmptyNeg.length > 0) {
-        out.append("Negative Entries to Delete:\n");
-        for (int i = 0; i < nonEmptyNeg.length; i++) {
-          out.append("  ");
-          out.append(nonEmptyNeg[i].toString());
-        }
-      }
-    }
-
     return out.toString();
   }
 
-  /*--------------------------------------------------------------------------*/
-  /* Native Methods                                                           */
-  /*--------------------------------------------------------------------------*/
+  /////////////// native methods ////////////////////
 
   /**
    * Returns a formatted String representing the ACL for the specified path.
@@ -807,7 +411,7 @@ public class ACL implements Serializable, Comparable
   private native void setACLString(String path, String aclString) throws AFSException;
 
   /*====================================================================*/
-  /* INNER CLASSES                                                      */
+  /* INNER CLASSES  */
   /*====================================================================*/
 
   /**
@@ -985,13 +589,13 @@ public class ACL implements Serializable, Comparable
       username = user;
     }
     /** 
-     * <IMG SRC="file.gif" ALT="File Permission" WIDTH="16" HEIGHT="16" BORDER="0"> Tests whether the ACL permits <code>read</code> access.
+     * <IMG SRC="file.gif" ALT="File Permission" WIDTH="15" HEIGHT="15" BORDER="0"> Tests whether the ACL permits <code>read</code> access.
      *
      * <p> This permission enables a user to read the contents of files in the directory 
      * and to obtain complete status information for the files (read/retrieve the file 
      * attributes).
      *
-     * <p><FONT COLOR="666699"><IMG SRC="file.gif" ALT="File Permission" WIDTH="16" HEIGHT="16" BORDER="0"> <U><B>File Permission</B></U></FONT><BR>
+     * <p><FONT COLOR="666699"><IMG SRC="file.gif" ALT="File Permission" WIDTH="15" HEIGHT="15" BORDER="0"> <U><B>File Permission</B></U></FONT><BR>
      * This permission is meaningful with respect to files in 
      * a directory, rather than the directory itself or its subdirectories. 
      *
@@ -1016,7 +620,7 @@ public class ACL implements Serializable, Comparable
       r = flag;
     }
     /** 
-     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> Tests whether the ACL permits lookup access.
+     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> Tests whether the ACL permits lookup access.
      *
      * <p> This permission functions as something of a gate keeper for access to the directory 
      * and its files, because a user must have it in order to exercise any other permissions. 
@@ -1036,7 +640,7 @@ public class ACL implements Serializable, Comparable
      * the directory. Those operations require the <code>lookup</code> permission on the ACL
      * of the subdirectory itself.
      *
-     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
+     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
      * This permission is meaningful with respect to the 
      * directory itself. For example, the <code>insert</code> permission (see: {@link #canInsert})
      * does not control addition of data to a file, but rather creation of a new file or 
@@ -1063,13 +667,13 @@ public class ACL implements Serializable, Comparable
       l = flag;
     }
     /** 
-     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> Tests whether the ACL permits <code>insert</code> access.
+     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> Tests whether the ACL permits <code>insert</code> access.
      *
      * <p> This permission enables a user to add new files to the directory, either by creating 
      * or copying, and to create new subdirectories. It does not extend into any subdirectories,
      * which are protected by their own ACLs.
      *
-     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
+     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
      * This permission is meaningful with respect to the 
      * directory itself. For example, the <code>insert</code> permission (see: {@link #canInsert})
      * does not control addition of data to a file, but rather creation of a new file or 
@@ -1096,13 +700,13 @@ public class ACL implements Serializable, Comparable
       i = flag;
     }
     /** 
-     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> Tests whether the ACL permits <code>delete</code> access.
+     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> Tests whether the ACL permits <code>delete</code> access.
      *
      * <p> This permission enables a user to remove files and subdirectories from the directory 
      * or move them into other directories (assuming that the user has the <code>insert</code>
      * (see: {@link #canInsert}) permission on the ACL of the other directories).
      *
-     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
+     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
      * This permission is meaningful with respect to the 
      * directory itself. For example, the <code>insert</code> permission (see: {@link #canInsert})
      * does not control addition of data to a file, but rather creation of a new file or 
@@ -1129,12 +733,12 @@ public class ACL implements Serializable, Comparable
       d = flag;
     }
     /** 
-     * <IMG SRC="file.gif" ALT="File Permission" WIDTH="16" HEIGHT="16" BORDER="0"> Tests whether the ACL permits <code>write</code> access.
+     * <IMG SRC="file.gif" ALT="File Permission" WIDTH="15" HEIGHT="15" BORDER="0"> Tests whether the ACL permits <code>write</code> access.
      *
      * <p> This permission enables a user to modify the contents of files in the directory 
      * and to change their operating system specific mode bits. 
      *
-     * <p><FONT COLOR="666699"><IMG SRC="file.gif" ALT="File Permission" WIDTH="16" HEIGHT="16" BORDER="0"> <U><B>File Permission</B></U></FONT><BR>
+     * <p><FONT COLOR="666699"><IMG SRC="file.gif" ALT="File Permission" WIDTH="15" HEIGHT="15" BORDER="0"> <U><B>File Permission</B></U></FONT><BR>
      * This permission is meaningful with respect to files in 
      * a directory, rather than the directory itself or its subdirectories. 
      *
@@ -1159,12 +763,12 @@ public class ACL implements Serializable, Comparable
       w = flag;
     }
     /** 
-     * <IMG SRC="file.gif" ALT="File Permission" WIDTH="16" HEIGHT="16" BORDER="0"> Tests whether the ACL permits the <code>lock</code> authority.
+     * <IMG SRC="file.gif" ALT="File Permission" WIDTH="15" HEIGHT="15" BORDER="0"> Tests whether the ACL permits the <code>lock</code> authority.
      *
      * <p> This permission enables the user to run programs that issue system calls to 
      * lock files in the directory. 
      *
-     * <p><FONT COLOR="666699"><IMG SRC="file.gif" ALT="File Permission" WIDTH="16" HEIGHT="16" BORDER="0"> <U><B>File Permission</B></U></FONT><BR>
+     * <p><FONT COLOR="666699"><IMG SRC="file.gif" ALT="File Permission" WIDTH="15" HEIGHT="15" BORDER="0"> <U><B>File Permission</B></U></FONT><BR>
      * This permission is meaningful with respect to files in 
      * a directory, rather than the directory itself or its subdirectories. 
      *
@@ -1189,7 +793,7 @@ public class ACL implements Serializable, Comparable
       k = flag;
     }
     /** 
-     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> Tests whether the ACL permits <code>administer</code> access.
+     * <IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> Tests whether the ACL permits <code>administer</code> access.
      *
      * <p> This permission enables a user to change the directory's ACL. Members of the 
      * <code>system:administrators</code> group implicitly have this permission on every 
@@ -1197,7 +801,7 @@ public class ACL implements Serializable, Comparable
      * owner of a directory implicitly has this permission on its ACL and those of all 
      * directories below it that he or she owns. 
      *
-     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="16" HEIGHT="16" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
+     * <p><FONT COLOR="666699"><IMG SRC="folder.gif" ALT="Directory Permission" WIDTH="15" HEIGHT="15" BORDER="0"> <U><B>Directory Permission</B></U></FONT><BR>
      * This permission is meaningful with respect to the 
      * directory itself. For example, the <code>insert</code> permission (see: {@link #canInsert})
      * does not control addition of data to a file, but rather creation of a new file or 
@@ -1261,3 +865,12 @@ public class ACL implements Serializable, Comparable
 
   }
 }
+
+
+
+
+
+
+
+
+
index ed6154e..a250f9a 100644 (file)
@@ -187,3 +187,18 @@ public class AFSException extends Exception
   }
   /*-----------------------------------------------------------------------*/
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 2a138ec..2aacb40 100644 (file)
@@ -185,3 +185,18 @@ public class AFSSecurityException extends SecurityException
   }
   /*-----------------------------------------------------------------------*/
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 61aa84a..9f6c96a 100644 (file)
@@ -115,7 +115,7 @@ public class Cell implements java.io.Serializable
   protected ArrayList serverNames;
 
   protected String name;
-  protected int cellHandle;
+  protected long cellHandle;
   protected Token token;
 
   protected int maxGroupID;
@@ -142,7 +142,7 @@ public class Cell implements java.io.Serializable
     this.name  = token.getCellName();
 
     cellHandle = getCellHandle( name, token.getHandle() );
-
+//System.out.println("cellHandle: " + cellHandle);
     users = null;
     userNames = null;
     groups = null;
@@ -270,7 +270,7 @@ public class Cell implements java.io.Serializable
 
   /**
    * Sets all the information fields of this <code>Cell</code> object, 
-   * such as max group and user ids, to their most current values.
+   * such as max group and user ids, to trheir most current values.
    *
    * @exception AFSException  If an error occurs in the native code     
    */
@@ -293,7 +293,7 @@ public class Cell implements java.io.Serializable
     users = new ArrayList();
 
     // get kas entries
-    int iterationId = getKasUsersBegin( cellHandle );
+    long iterationId = getKasUsersBegin( cellHandle );
 
     currUser = new User( this );
     boolean authorized = false;
@@ -310,13 +310,8 @@ public class Cell implements java.io.Serializable
         System.err.println("ERROR Cell::refreshUsers():kas (User: " 
                           + currUser.getName() + ") -> " + e.getMessage());
         authorized = false;
-        if (org.openafs.jafs.ErrorTable.isPermissionDenied(e.getErrorCode())) {
-         // Check to see if the user has failed more than 25 times,
-         // if so it is most likely because they are not appropriately
-         // authorized to list or examine users.  May want to check for
-         // KAS admin attribute.
-         if ( r++ > 25 ) r = 0;
-       }
+        //if (org.openafs.jafs.ErrorCodes.isPermissionDenied(e.getErrorCode())) 
+       //r = 0;
       }
     } 
     getKasUsersDone( iterationId );
@@ -339,13 +334,8 @@ public class Cell implements java.io.Serializable
         System.err.println("ERROR Cell::refreshUsers():pts (User: " 
                           + currUser.getName() + ") -> " + e.getMessage());
         authorized = false;
-        if (org.openafs.jafs.ErrorTable.isPermissionDenied(e.getErrorCode())) {
-         // Check to see if the user has failed more than 25 times,
-         // if so it is most likely because they are not appropriately
-         // authorized to list or examine users.  May want to check for
-         // KAS admin attribute.
-         if ( r++ > 25 ) r = 0;
-       }
+        //if (org.openafs.jafs.ErrorCodes.isPermissionDenied(e.getErrorCode())) 
+       // r = 0;
       }
     } 
     getPtsUsersDone( iterationId );
@@ -364,7 +354,7 @@ public class Cell implements java.io.Serializable
     userNames = new ArrayList();
 
     // get kas entries
-    int iterationId = getKasUsersBegin( cellHandle );
+    long iterationId = getKasUsersBegin( cellHandle );
     while( ( currName = getKasUsersNextString( iterationId )) != null ) {
       userNames.add( currName );
     } 
@@ -391,7 +381,7 @@ public class Cell implements java.io.Serializable
   {
     Group currGroup;
 
-    int iterationId = getGroupsBegin( cellHandle );
+    long iterationId = getGroupsBegin( cellHandle );
     
     groups = new ArrayList();
     
@@ -407,13 +397,13 @@ public class Cell implements java.io.Serializable
         r = getGroupsNext( cellHandle, iterationId, currGroup );
         authorized = true;
       } catch (AFSException e) {
-        System.err.println("ERROR Cell::refreshGroups() (Group: " 
-                          + currGroup.getName() + ") -> " + e.getMessage());
-        authorized = false;
-        if (org.openafs.jafs.ErrorTable.isPermissionDenied(e.getErrorCode())) {
-         if ( r++ > 25 ) r = 0;
-       }
+       e.printStackTrace();
 
+//        System.err.println("ERROR Cell::refreshGroups() (Group: " 
+//                        + currGroup.getName() + ") -> " + e.getMessage());
+        authorized = false;
+        //if (org.openafs.jafs.ErrorCodes.isPermissionDenied(e.getErrorCode())) 
+       // r = 0;
       }
     } 
     Cell.getGroupsDone( iterationId );
@@ -428,7 +418,7 @@ public class Cell implements java.io.Serializable
   {
     String currName;
 
-    int iterationId = getGroupsBegin( cellHandle );
+    long iterationId = getGroupsBegin( cellHandle );
     
     groupNames = new ArrayList();
     while( ( currName = getGroupsNextString( iterationId ) ) != null ) {
@@ -446,7 +436,7 @@ public class Cell implements java.io.Serializable
   {
     Server currServer;
 
-    int iterationId = getServersBegin( cellHandle );
+    long iterationId = getServersBegin( cellHandle );
    
     servers = new ArrayList();
     
@@ -456,21 +446,20 @@ public class Cell implements java.io.Serializable
     while( r != 0 ) {
       try {
         if (authorized) {
-          System.out.println("[Java] Cell::refreshServers() -> adding server: " 
-                            + currServer.getName());
+          //System.out.println("[Java] Cell::refreshServers() -> adding server: " 
+               //           + currServer.getName());
           servers.add( currServer );
           currServer = new Server( this );
         }
         r = getServersNext( cellHandle, iterationId, currServer );
-System.out.println("[Java] Cell::refreshServers() -> r: " + r);
+//System.out.println("[Java] Cell::refreshServers() -> r: " + r);
         authorized = true;
       } catch (AFSException e) {
         System.err.println("ERROR Cell::refreshServers() (Server: " 
                           + currServer.getName() + ") -> " + e.getMessage());
         authorized = false;
-        if (org.openafs.jafs.ErrorTable.isPermissionDenied(e.getErrorCode())) {
-         if ( r++ > 25 ) r = 0;
-       }
+        //if (e.getErrorCode() == org.openafs.jafs.ErrorCodes.PERMISSION_DENIED) 
+        // r = 0;
       }
     } 
     getServersDone( iterationId );
@@ -486,7 +475,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
   {
     String currName;
 
-    int iterationId = getServersBegin( cellHandle );
+    long iterationId = getServersBegin( cellHandle );
 
     serverNames = new ArrayList();
     while( ( currName = getServersNextString( iterationId ) ) != null ) {
@@ -658,7 +647,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
     User[] users  = new User[length];
     User currUser = new User( this );
     int ptsOnlyCount = getPtsOnlyUserCount(cellHandle);
-    int iterationID = 0;
+    long iterationID = 0;
     int indexPTS = 0;
     int indexKAS = 0;
 
@@ -800,7 +789,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
     String[] users  = new String[length];
     String currUser;
     int ptsOnlyCount = getPtsOnlyUserCount(cellHandle);
-    int iterationID = 0;
+    long iterationID = 0;
     int indexPTS = 0;
     int indexKAS = 0;
 
@@ -968,7 +957,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
     Group currGroup = new Group( this );
     int i = 0;
 
-    int iterationID = getGroupsBeginAt( cellHandle, startIndex );
+    long iterationID = getGroupsBeginAt( cellHandle, startIndex );
 
     while( getGroupsNext( cellHandle, iterationID, currGroup ) != 0 
           && i < length ) {
@@ -1065,7 +1054,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
     String currGroup;
     int i = 0;
 
-    int iterationID = getGroupsBeginAt( cellHandle, startIndex );
+    long iterationID = getGroupsBeginAt( cellHandle, startIndex );
 
     while( (currGroup = getGroupsNextString( iterationID )) != null &&
             i < length )
@@ -1216,7 +1205,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return the cell handle
    * @exception AFSException  If an error occurs in the native code
    */
-  public int getCellHandle() throws AFSException
+  public long getCellHandle() throws AFSException
   {
     return cellHandle;
   }
@@ -1266,7 +1255,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    *
    * @return    a <code>String</code> representation of this <code>Cell</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
     String r = "Cell: " + name + "\n\n";
     try {
@@ -1320,7 +1309,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return    a <code>String</code> representation of the users
    * @see       User#getInfo
    */
-  protected String getInfoUsers() throws AFSException
+  public String getInfoUsers() throws AFSException
   {
     String r;
 
@@ -1342,7 +1331,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return    a <code>String</code> representation of the groups
    * @see       Group#getInfo
    */
-  protected String getInfoGroups() throws AFSException
+  public String getInfoGroups() throws AFSException
   {
     String r;
 
@@ -1363,7 +1352,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return    a <code>String</code> representation of the servers
    * @see       Server#getInfo
    */
-  protected String getInfoServers() 
+  public String getInfoServers() 
       throws AFSException
   {
     String r;
@@ -1412,7 +1401,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getKasUserCount( int cellHandle )
+  protected static native int getKasUserCount( long cellHandle )
     throws AFSException;
 
   /**
@@ -1426,7 +1415,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getKasUsersBegin( int cellHandle )
+  protected static native long getKasUsersBegin( long cellHandle )
     throws AFSException;
 
   /**
@@ -1442,7 +1431,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getKasUsersBeginAt( int cellHandle,
+  protected static native long getKasUsersBeginAt( long cellHandle,
                                                   int startIndex )
     throws AFSException;
 
@@ -1456,7 +1445,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return the name of the next user of the cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getKasUsersNextString( int iterationId )
+  protected static native String getKasUsersNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -1472,8 +1461,8 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return 0 if there are no more users, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getKasUsersNext( int cellHandle,  
-                                              int iterationId, 
+  protected static native int getKasUsersNext( long cellHandle,  
+                                              long iterationId, 
                                               User theUser )
     throws AFSException;
 
@@ -1484,7 +1473,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @see Cell#getKasUsersBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getKasUsersDone( int iterationId )
+  protected static native void getKasUsersDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1496,7 +1485,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getPtsUserCount( int cellHandle )
+  protected static native int getPtsUserCount( long cellHandle )
     throws AFSException;
 
   /**
@@ -1508,7 +1497,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getPtsOnlyUserCount( int cellHandle )
+  protected static native int getPtsOnlyUserCount( long cellHandle )
     throws AFSException;
 
   /**
@@ -1522,7 +1511,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getPtsUsersBegin( int cellHandle )
+  protected static native long getPtsUsersBegin( long cellHandle )
     throws AFSException;
 
   /**
@@ -1534,7 +1523,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return the name of the next user of the cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getPtsUsersNextString( int iterationId )
+  protected static native String getPtsUsersNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -1547,8 +1536,8 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return the name of the next pts user (not kas user) of the cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getPtsOnlyUsersNextString( int iterationId, 
-                                                           int cellHandle )
+  protected static native String getPtsOnlyUsersNextString( long iterationId, 
+                                                           long cellHandle )
     throws AFSException;
 
   /**
@@ -1564,7 +1553,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return 0 if there are no more users, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getPtsUsersNext( int cellHandle, int iterationId,
+  protected static native int getPtsUsersNext( long cellHandle, long iterationId,
                                               User theUser )
     throws AFSException;
 
@@ -1581,8 +1570,8 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return 0 if there are no more users, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getPtsOnlyUsersNext( int cellHandle, 
-                                                  int iterationId, 
+  protected static native int getPtsOnlyUsersNext( long cellHandle, 
+                                                  long iterationId, 
                                                   User theUser )
     throws AFSException;
 
@@ -1593,7 +1582,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @see Cell#getPtsUsersBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getPtsUsersDone( int iterationId )
+  protected static native void getPtsUsersDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1605,7 +1594,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getGroupCount( int cellHandle )
+  protected static native int getGroupCount( long cellHandle )
     throws AFSException;
 
   /**
@@ -1619,7 +1608,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getGroupsBegin( int cellHandle )
+  protected static native long getGroupsBegin( long cellHandle )
     throws AFSException;
 
   /**
@@ -1634,7 +1623,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getGroupsBeginAt( int cellHandle, 
+  protected static native long getGroupsBeginAt( long cellHandle, 
                                                 int startIndex )
     throws AFSException;
 
@@ -1647,7 +1636,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return the name of the next user of the cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getGroupsNextString( int iterationId )
+  protected static native String getGroupsNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -1663,7 +1652,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return 0 if there are no more users, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getGroupsNext( int cellHandle, int iterationId, 
+  protected static native int getGroupsNext( long cellHandle, long iterationId, 
                                             Group theGroup )
     throws AFSException;
 
@@ -1674,7 +1663,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @see Cell#getGroupsBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getGroupsDone( int iterationId )
+  protected static native void getGroupsDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1686,7 +1675,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getServerCount( int cellHandle )
+  protected static native int getServerCount( long cellHandle )
     throws AFSException;
 
   /**
@@ -1699,7 +1688,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getServersBegin( int cellHandle )
+  protected static native long getServersBegin( long cellHandle )
     throws AFSException;
 
   /**
@@ -1711,7 +1700,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return the name of the next server of the cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getServersNextString( int iterationId )
+  protected static native String getServersNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -1727,7 +1716,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return 0 if there are no more servers, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getServersNext( int cellHandle, int iterationId, 
+  protected static native int getServersNext( long cellHandle, long iterationId, 
                                              Server theServer )
     throws AFSException;
 
@@ -1738,7 +1727,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @see Cell#getServersBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getServersDone( int iterationId )
+  protected static native void getServersDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1749,7 +1738,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return the name of the cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getCellName( int cellHandle )
+  protected static native String getCellName( long cellHandle )
     throws AFSException;
 
   /**
@@ -1764,7 +1753,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @param forceCheck  whether or not to check if this volume name exists
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void createMountPoint( int cellHandle, 
+  protected static native void createMountPoint( long cellHandle, 
                                                 String directory, 
                                                 String volumeName, 
                                                 boolean readWrite, 
@@ -1803,7 +1792,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return an integer reresenting the max group id in a cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getMaxGroupID( int cellHandle )
+  protected static native int getMaxGroupID( long cellHandle )
     throws AFSException;
 
   /**
@@ -1815,7 +1804,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @param maxID an integer reresenting the new max group id in a cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void setMaxGroupID( int cellHandle, int maxID )
+  protected static native void setMaxGroupID( long cellHandle, int maxID )
     throws AFSException;
 
   /**
@@ -1828,7 +1817,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @return an integer reresenting the max user id in a cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getMaxUserID( int cellHandle )
+  protected static native int getMaxUserID( long cellHandle )
     throws AFSException;
 
   /**
@@ -1840,7 +1829,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @param maxID an integer reresenting the new max user id in a cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void setMaxUserID( int cellHandle, int maxID )
+  protected static native void setMaxUserID( long cellHandle, int maxID )
     throws AFSException;
 
   /**
@@ -1865,7 +1854,7 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @exception AFSException  If an error occurs in the native code
    * @see Token#getHandle
    */
-  protected static native int getCellHandle( String cellName, int tokenHandle )
+  protected static native long getCellHandle( String cellName, long tokenHandle )
        throws AFSException;
  
   /**
@@ -1874,6 +1863,14 @@ System.out.println("[Java] Cell::refreshServers() -> r: " + r);
    * @param cellHandle   the cell handle to close
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void closeCell( int cellHandle ) 
+  protected static native void closeCell( long cellHandle ) 
        throws AFSException;
 }
+
+
+
+
+
+
+
+
index 1572e45..9a58391 100644 (file)
@@ -111,7 +111,7 @@ public class Group implements PTSEntry, Serializable, Comparable
   public static final int GROUP_ANYUSER_ACCESS = 2;
 
   protected Cell cell;
-  protected int cellHandle;
+  protected long cellHandle;
   protected String name;
   
   protected int membershipCount;
@@ -487,7 +487,7 @@ public class Group implements PTSEntry, Serializable, Comparable
   {
     User currUser;
 
-    int iterationID = Group.getGroupMembersBegin( cell.getCellHandle(), name );
+    long iterationID = Group.getGroupMembersBegin( cell.getCellHandle(), name );
 
     members = new ArrayList();
 
@@ -511,7 +511,7 @@ public class Group implements PTSEntry, Serializable, Comparable
   protected void refreshMemberNames() throws AFSException
   {
     String currName;
-    int iterationID = Group.getGroupMembersBegin( cell.getCellHandle(), name );
+    long iterationID = Group.getGroupMembersBegin( cell.getCellHandle(), name );
 
     memberNames = new ArrayList();
 
@@ -533,7 +533,7 @@ public class Group implements PTSEntry, Serializable, Comparable
   {
     Group currGroup;
 
-    int iterationID = User.getGroupsOwnedBegin( cell.getCellHandle(), name );
+    long iterationID = User.getGroupsOwnedBegin( cell.getCellHandle(), name );
 
     groupsOwned = new ArrayList();
 
@@ -557,7 +557,7 @@ public class Group implements PTSEntry, Serializable, Comparable
   {
     String currName;
 
-    int iterationID = User.getGroupsOwnedBegin( cell.getCellHandle(), name );
+    long iterationID = User.getGroupsOwnedBegin( cell.getCellHandle(), name );
 
     groupsOwnedNames = new ArrayList();
     while( ( currName = User.getGroupsOwnedNextString( iterationID ) ) 
@@ -1010,7 +1010,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    *
    * @return a <code>String</code> representation of the <code>Group</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
     String r;
     try {
@@ -1108,7 +1108,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    *                automatically assigned)
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void create( int cellHandle, String groupName, 
+  protected static native void create( long cellHandle, String groupName, 
                                       String ownerName, int gid )
        throws AFSException;
 
@@ -1122,7 +1122,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @param groupName      the name of the group to delete
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void delete( int cellHandle, String groupName )
+  protected static native void delete( long cellHandle, String groupName )
        throws AFSException;
 
   /**
@@ -1137,7 +1137,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @see Group
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getGroupInfo( int cellHandle, String name, 
+  protected static native void getGroupInfo( long cellHandle, String name, 
                                             Group group ) 
        throws AFSException;
 
@@ -1150,7 +1150,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @param theGroup   the group object containing the desired information
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void setGroupInfo( int cellHandle, String name, 
+  protected static native void setGroupInfo( long cellHandle, String name, 
                                             Group theGroup ) 
        throws AFSException;
 
@@ -1165,7 +1165,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native int getGroupMembersBegin( int cellHandle, 
+  protected static native long getGroupMembersBegin( long cellHandle, 
                                                    String name )
        throws AFSException;
 
@@ -1174,11 +1174,11 @@ public class Group implements PTSEntry, Serializable, Comparable
    * <code>null</code> if there are no more members.
    *
    * @param iterationId   the iteration ID of this iteration
-   * @see #getGroupMembersBegin
+   * @see getGroupMembersBegin
    * @return the name of the next member
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native String getGroupMembersNextString( int iterationId ) 
+  protected static native String getGroupMembersNextString( long iterationId ) 
        throws AFSException;
 
   /**
@@ -1188,14 +1188,14 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @param cellHandle    the handle of the cell to which the users belong
    * @see Cell#getCellHandle
    * @param iterationId   the iteration ID of this iteration
-   * @see #getGroupMembersBegin
+   * @see getGroupMembersBegin
    * @param theUser   a User object to be populated with the values of the 
    *                  next user
    * @return 0 if there are no more users, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getGroupMembersNext( int cellHandle, 
-                                                  int iterationId, 
+  protected static native int getGroupMembersNext( long cellHandle, 
+                                                  long iterationId, 
                                                   User theUser )
     throws AFSException;
 
@@ -1203,10 +1203,10 @@ public class Group implements PTSEntry, Serializable, Comparable
    * Signals that the iteration is complete and will not be accessed anymore.
    *
    * @param iterationId   the iteration ID of this iteration
-   * @see #getGroupMembersBegin
+   * @see getGroupMembersBegin
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getGroupMembersDone( int iterationId )
+  protected static native void getGroupMembersDone( long iterationId )
        throws AFSException;
 
   /**
@@ -1218,7 +1218,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @param userName      the name of the user to add
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void addMember( int cellHandle, String groupName, 
+  protected static native void addMember( long cellHandle, String groupName, 
                                          String userName )
        throws AFSException;
 
@@ -1232,7 +1232,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @param userName      the name of the user to remove
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void removeMember( int cellHandle, String groupName, 
+  protected static native void removeMember( long cellHandle, String groupName, 
                                             String userName )
        throws AFSException;
 
@@ -1246,7 +1246,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @param ownerName      the name of the new owner
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void changeOwner( int cellHandle, String groupName, 
+  protected static native void changeOwner( long cellHandle, String groupName, 
                                            String ownerName )
        throws AFSException;
 
@@ -1259,7 +1259,7 @@ public class Group implements PTSEntry, Serializable, Comparable
    * @param newGroupName      the new name for the group
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void rename( int cellHandle, String oldGroupName, 
+  protected static native void rename( long cellHandle, String oldGroupName, 
                                       String newGroupName )
        throws AFSException;
 
index 7f22733..e92988f 100644 (file)
@@ -329,7 +329,7 @@ public class Key implements Serializable, Comparable
    *
    * @return a <code>String</code> representation of the <code>Key</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
     String r;
     try {
@@ -417,7 +417,7 @@ public class Key implements Serializable, Comparable
    * @see Server
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getKeyInfo( int serverHandle, int version, 
+  protected static native void getKeyInfo( long serverHandle, int version, 
                                           Key key ) 
        throws AFSException;
 
@@ -434,7 +434,7 @@ public class Key implements Serializable, Comparable
    *                      be encrypted
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void create( int cellHandle, int serverHandle, int versionNumber, String keyString )
+  protected static native void create( long cellHandle, long serverHandle, int versionNumber, String keyString )
     throws AFSException;
 
   /**
@@ -445,7 +445,7 @@ public class Key implements Serializable, Comparable
    * @param versionNumber   the version number of the key to remove (0 to 255)
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void delete( int serverHandle, int versionNumber )
+  protected static native void delete( long serverHandle, int versionNumber )
     throws AFSException;
 
   /**
@@ -457,3 +457,11 @@ public class Key implements Serializable, Comparable
   protected static native void reclaimKeyMemory();
 
 }
+
+
+
+
+
+
+
+
index bf10c20..083c36d 100644 (file)
@@ -266,7 +266,7 @@ public class Partition implements Serializable, Comparable
   {
     Volume currVolume;
 
-    int iterationID = getVolumesBegin( cell.getCellHandle(), 
+    long iterationID = getVolumesBegin( cell.getCellHandle(), 
                                       server.getVosHandle(), getID() );
 
     volumes = new ArrayList();
@@ -288,7 +288,7 @@ public class Partition implements Serializable, Comparable
   {
     String currName;
 
-    int iterationID = getVolumesBegin( cell.getCellHandle(), 
+    long iterationID = getVolumesBegin( cell.getCellHandle(), 
                                       server.getVosHandle(), getID() );
        
     volumeNames = new ArrayList();
@@ -486,7 +486,7 @@ public class Partition implements Serializable, Comparable
     Volume currVolume = new Volume( this );
     int i = 0;
 
-    int iterationID = getVolumesBeginAt( cell.getCellHandle(), 
+    long iterationID = getVolumesBeginAt( cell.getCellHandle(), 
                                       server.getVosHandle(), getID(), startIndex );
 
     while( getVolumesNext( iterationID, currVolume ) != 0 && i < length ) {
@@ -583,7 +583,7 @@ public class Partition implements Serializable, Comparable
     String currName;
     int i = 0;
 
-    int iterationID = getVolumesBeginAt( cell.getCellHandle(), 
+    long iterationID = getVolumesBeginAt( cell.getCellHandle(), 
                                       server.getVosHandle(), getID(), startIndex );
 
     while( ( currName = getVolumesNextString( iterationID ) ) != null && i < length ) {
@@ -778,7 +778,7 @@ public class Partition implements Serializable, Comparable
    *
    * @return a <code>String</code> representation of the <code>Partition</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
     String r;
     
@@ -812,7 +812,7 @@ public class Partition implements Serializable, Comparable
    * @return    a <code>String</code> representation of the volumes
    * @see       Volume#getInfo
    */
-  protected String getInfoVolumes() throws AFSException
+  public String getInfoVolumes() throws AFSException
   {
        String r;
 
@@ -896,8 +896,8 @@ public class Partition implements Serializable, Comparable
    *                       fill in the information
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getPartitionInfo( int cellHandle, 
-                                                int serverHandle, 
+  protected static native void getPartitionInfo( long cellHandle, 
+                                                long serverHandle, 
                                                 int partition, 
                                                 Partition thePartition ) 
     throws AFSException;
@@ -915,8 +915,8 @@ public class Partition implements Serializable, Comparable
    * @see Cell#getCellHandle
    * @see Server#getVosServerHandle
    */
-  protected static native int getVolumeCount( int cellHandle, 
-                                              int serverHandle, 
+  protected static native int getVolumeCount( long cellHandle, 
+                                              long serverHandle, 
                                               int partition )
     throws AFSException;
 
@@ -935,8 +935,8 @@ public class Partition implements Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getVolumesBegin( int cellHandle, 
-                                              int serverHandle, 
+  protected static native long getVolumesBegin( long cellHandle, 
+                                              long serverHandle, 
                                               int partition )
     throws AFSException;
 
@@ -955,8 +955,8 @@ public class Partition implements Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getVolumesBeginAt( int cellHandle, 
-                                                int serverHandle, 
+  protected static native long getVolumesBeginAt( long cellHandle, 
+                                                long serverHandle, 
                                                 int partition, int index )
     throws AFSException;
 
@@ -969,7 +969,7 @@ public class Partition implements Serializable, Comparable
    * @return the name of the next volume of the server
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getVolumesNextString( int iterationId )
+  protected static native String getVolumesNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -983,7 +983,7 @@ public class Partition implements Serializable, Comparable
    * @return 0 if there are no more volumes, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getVolumesNext( int iterationId, 
+  protected static native int getVolumesNext( long iterationId, 
                                              Volume theVolume )
     throws AFSException;
 
@@ -998,7 +998,7 @@ public class Partition implements Serializable, Comparable
    * @return 0 if there are no more volumes, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getVolumesAdvanceTo( int iterationId, 
+  protected static native int getVolumesAdvanceTo( long iterationId, 
                                                   Volume theVolume, 
                                                   int advanceCount )
     throws AFSException;
@@ -1010,7 +1010,7 @@ public class Partition implements Serializable, Comparable
    * @see #getVolumesBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getVolumesDone( int iterationId )
+  protected static native void getVolumesDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1041,3 +1041,12 @@ public class Partition implements Serializable, Comparable
    */
   protected static native void reclaimPartitionMemory();
 }
+
+
+
+
+
+
+
+
+
index b006db3..178be3d 100644 (file)
@@ -128,7 +128,7 @@ public class Process implements Serializable, Comparable
 
   protected String name;
   protected Server server;
-  protected int serverHandle;
+  protected long serverHandle;
 
   protected int type;
   protected int state;
@@ -687,7 +687,7 @@ public class Process implements Serializable, Comparable
    *
    * @return a <code>String</code> representation of the <code>Process</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
     String r;
     try {
@@ -853,7 +853,7 @@ public class Process implements Serializable, Comparable
    *                       in the information
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getProcessInfo( int cellHandle, 
+  protected static native void getProcessInfo( long cellHandle, 
                                               String processName, 
                                               Process theProcess ) 
        throws AFSException;
@@ -884,7 +884,7 @@ public class Process implements Serializable, Comparable
    *                   <code>null</code>
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void create( int serverHandle, String processName, 
+  protected static native void create( long serverHandle, String processName, 
                                       int processType, String executionPath, 
                                       String cronTime, String notifier )
     throws AFSException;
@@ -898,7 +898,7 @@ public class Process implements Serializable, Comparable
    * @param processName   the name of the process to remove
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void delete( int serverHandle, String processName )
+  protected static native void delete( long serverHandle, String processName )
     throws AFSException;
 
   /**
@@ -910,7 +910,7 @@ public class Process implements Serializable, Comparable
    * @param processName   the name of the process to start
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void start( int serverHandle, String processName )
+  protected static native void start( long serverHandle, String processName )
     throws AFSException;
 
   /**
@@ -922,7 +922,7 @@ public class Process implements Serializable, Comparable
    * @param processName   the name of the process to restart
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void restart( int serverHandle, String processName )
+  protected static native void restart( long serverHandle, String processName )
     throws AFSException;
 
   /**
@@ -934,7 +934,7 @@ public class Process implements Serializable, Comparable
    * @param processName   the name of the process to stop
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void stop( int serverHandle, String processName )
+  protected static native void stop( long serverHandle, String processName )
     throws AFSException;
 
   /**
index 1446634..1f826e9 100644 (file)
@@ -108,8 +108,8 @@ public class Server implements Serializable, Comparable
   protected String name;
   protected Cell cell;
 
-  protected int vosHandle;
-  protected int bosHandle;
+  protected long vosHandle;
+  protected long bosHandle;
 
   protected boolean database;
   protected boolean fileServer;
@@ -353,7 +353,7 @@ public class Server implements Serializable, Comparable
 
     Partition currPartition;
 
-    int iterationID = getPartitionsBegin( cell.getCellHandle(), 
+    long iterationID = getPartitionsBegin( cell.getCellHandle(), 
                                          getVosHandle() );
     
     partitions = new ArrayList();
@@ -384,7 +384,7 @@ public class Server implements Serializable, Comparable
 
     String currName;
 
-    int iterationID = getPartitionsBegin( cell.getCellHandle(), 
+    long iterationID = getPartitionsBegin( cell.getCellHandle(), 
                                          getVosHandle() );
     
     partitionNames = new ArrayList();
@@ -404,7 +404,7 @@ public class Server implements Serializable, Comparable
   {
     String currName;
 
-    int iterationID = getBosAdminsBegin( getBosHandle() );
+    long iterationID = getBosAdminsBegin( getBosHandle() );
     
     adminNames = new ArrayList();
     
@@ -424,7 +424,7 @@ public class Server implements Serializable, Comparable
   {
     User currUser;
 
-    int iterationID = getBosAdminsBegin( getBosHandle() );
+    long iterationID = getBosAdminsBegin( getBosHandle() );
        
     admins = new ArrayList();
        
@@ -446,7 +446,7 @@ public class Server implements Serializable, Comparable
   {
     Key currKey;
 
-    int iterationID = getKeysBegin( getBosHandle() );
+    long iterationID = getKeysBegin( getBosHandle() );
     
     keys = new ArrayList();
     
@@ -467,7 +467,7 @@ public class Server implements Serializable, Comparable
   {
     String currName;
 
-    int iterationID = getProcessesBegin( getBosHandle() );
+    long iterationID = getProcessesBegin( getBosHandle() );
     
     processNames = new ArrayList();
     
@@ -487,7 +487,7 @@ public class Server implements Serializable, Comparable
   {
     Process currProcess;
 
-    int iterationID = getProcessesBegin( getBosHandle() );
+    long iterationID = getProcessesBegin( getBosHandle() );
     
     processes = new ArrayList();
     
@@ -814,8 +814,11 @@ public class Server implements Serializable, Comparable
   public Partition[] getPartitions() throws AFSException
   {
     if ( partitions == null ) refreshPartitions();
-    return (Partition []) 
-       partitions.toArray( new Partition[partitions.size()] );
+    if ( partitions != null) {
+       return (Partition []) partitions.toArray( new Partition[partitions.size()] );
+    } else {
+       return null;
+    }
   }
 
   /**
@@ -977,7 +980,10 @@ public class Server implements Serializable, Comparable
   public Process[] getProcesses() throws AFSException
   {
     if ( processes == null ) refreshProcesses();
-    return (Process[]) processes.toArray( new Process[processes.size()] );
+    if ( processes != null) {
+       return (Process[]) processes.toArray( new Process[processes.size()] );
+    }
+    return null;
   }
 
   /**
@@ -1197,7 +1203,7 @@ public class Server implements Serializable, Comparable
    * @return this server's vos handle
    * @exception AFSException  If an error occurs in the native code
    */
-  protected int getVosHandle() throws AFSException
+  protected long getVosHandle() throws AFSException
   {
     if ( vosHandle == 0 ) {
       vosHandle = getVosServerHandle( cell.getCellHandle(), name );
@@ -1211,7 +1217,7 @@ public class Server implements Serializable, Comparable
    * @return this server's bos handle
    * @exception AFSException  If an error occurs in the native code
    */
-  protected int getBosHandle() throws AFSException
+  protected long getBosHandle() throws AFSException
   {
     if ( bosHandle == 0 ) {
       bosHandle = getBosServerHandle( cell.getCellHandle(), name );
@@ -1260,7 +1266,7 @@ public class Server implements Serializable, Comparable
    *
    * @return a <code>String</code> representation of the <code>Server</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
     String r;
     try {
@@ -1322,7 +1328,7 @@ public class Server implements Serializable, Comparable
    * @return    a <code>String</code> representation of the partitions
    * @see       Partition#getInfo
    */
-  protected String getInfoPartitions() throws AFSException
+  public String getInfoPartitions() throws AFSException
   {
     String r;
     r = "Server: " + name + "\n\n";
@@ -1343,7 +1349,7 @@ public class Server implements Serializable, Comparable
    * @return    a <code>String</code> representation of the keys
    * @see       Key#getInfo
    */
-  protected String getInfoKeys() throws AFSException
+  public String getInfoKeys() throws AFSException
   {
     String r;
 
@@ -1366,7 +1372,7 @@ public class Server implements Serializable, Comparable
    * @return    a <code>String</code> representation of the processes
    * @see       Process#getInfo
    */
-  protected String getInfoProcesses() throws AFSException
+  public String getInfoProcesses() throws AFSException
   {
     String r;
 
@@ -1443,14 +1449,14 @@ public class Server implements Serializable, Comparable
    * methods as a means of identification.
    *
    * @param cellHandle    a cell handle previously returned by 
-   *                      a call to {@link Cell#getCellHandle}
+   *                      a call to {@link #getCellHandle}
    * @param serverName    the name of the server for which to retrieve 
    *                      a vos handle
    * @return a vos handle to the server
    * @exception AFSException  If an error occurs in the native code
-   * @see Cell#getCellHandle
+   * @see #getCellHandle
    */
-  protected static native int getVosServerHandle( int cellHandle, 
+  protected static native long getVosServerHandle( long cellHandle, 
                                                  String serverName )
        throws AFSException;
 
@@ -1460,7 +1466,7 @@ public class Server implements Serializable, Comparable
    * @param vosHandle   the vos server handle to close
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void closeVosServerHandle( int vosHandle ) 
+  protected static native void closeVosServerHandle( long vosHandle ) 
        throws AFSException; 
 
   /**
@@ -1469,14 +1475,14 @@ public class Server implements Serializable, Comparable
    * as a means of identification.
    *
    * @param cellHandle    a cell handle previously returned by a call 
-   *                      to {@link Cell#getCellHandle}
+   *                      to {@link #getCellHandle}
    * @param serverName    the name of the server for which to retrieve 
    *                      a bos handle
    * @return a bos handle to the server
    * @exception AFSException  If an error occurs in the native code
-   * @see Cell#getCellHandle
+   * @see #getCellHandle
    */
-  protected static native int getBosServerHandle( int cellHandle, 
+  protected static native long getBosServerHandle( long cellHandle, 
                                                  String serverName )
        throws AFSException;
 
@@ -1486,7 +1492,7 @@ public class Server implements Serializable, Comparable
    * @param bosHandle   the bos server handle to close
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void closeBosServerHandle( int bosHandle ) 
+  protected static native void closeBosServerHandle( long bosHandle ) 
        throws AFSException; 
 
   /**
@@ -1500,7 +1506,7 @@ public class Server implements Serializable, Comparable
    * @see Server
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getServerInfo( int cellHandle, String name, 
+  protected static native void getServerInfo( long cellHandle, String name, 
                                              Server server ) 
        throws AFSException;
 
@@ -1516,8 +1522,8 @@ public class Server implements Serializable, Comparable
    * @see Cell#getCellHandle
    * @see #getVosServerHandle
    */
-  protected static native int getPartitionCount( int cellHandle, 
-                                                 int serverHandle )
+  protected static native int getPartitionCount( long cellHandle, 
+                                                 long serverHandle )
     throws AFSException;
 
   /**
@@ -1533,8 +1539,8 @@ public class Server implements Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getPartitionsBegin( int cellHandle, 
-                                                 int serverHandle )
+  protected static native long getPartitionsBegin( long cellHandle, 
+                                                 long serverHandle )
     throws AFSException;
 
   /**
@@ -1546,7 +1552,7 @@ public class Server implements Serializable, Comparable
    * @return the name of the next partition of the server
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getPartitionsNextString( int iterationId )
+  protected static native String getPartitionsNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -1560,7 +1566,7 @@ public class Server implements Serializable, Comparable
    * @return 0 if there are no more servers, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getPartitionsNext( int iterationId, 
+  protected static native int getPartitionsNext( long iterationId, 
                                                 Partition thePartition )
     throws AFSException;
 
@@ -1571,7 +1577,7 @@ public class Server implements Serializable, Comparable
    * @see #getPartitionsBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getPartitionsDone( int iterationId )
+  protected static native void getPartitionsDone( long iterationId )
     throws AFSException;
   
   /**
@@ -1584,7 +1590,7 @@ public class Server implements Serializable, Comparable
    * @exception AFSException  If an error occurs in the native code
    * @see #getVosServerHandle
    */
-  protected static native int getProcessCount( int serverHandle )
+  protected static native int getProcessCount( long serverHandle )
     throws AFSException;
 
   /**
@@ -1598,7 +1604,7 @@ public class Server implements Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getProcessesBegin( int serverHandle )
+  protected static native long getProcessesBegin( long serverHandle )
     throws AFSException;
 
   /**
@@ -1610,7 +1616,7 @@ public class Server implements Serializable, Comparable
    * @return the name of the next process of the cell
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getProcessesNextString( int iterationId )
+  protected static native String getProcessesNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -1626,8 +1632,8 @@ public class Server implements Serializable, Comparable
    * @return 0 if there are no more processes, != otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getProcessesNext( int serverHandle, 
-                                               int iterationId, 
+  protected static native int getProcessesNext( long serverHandle, 
+                                               long iterationId, 
                                                Process theProcess )
     throws AFSException;
 
@@ -1638,7 +1644,7 @@ public class Server implements Serializable, Comparable
    * @see #getProcessesBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getProcessesDone( int iterationId )
+  protected static native void getProcessesDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1651,7 +1657,7 @@ public class Server implements Serializable, Comparable
    * @exception AFSException  If an error occurs in the native code
    * @see #getVosServerHandle
    */
-  protected static native int getKeyCount( int serverHandle )
+  protected static native int getKeyCount( long serverHandle )
     throws AFSException;
 
   /**
@@ -1664,7 +1670,7 @@ public class Server implements Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getKeysBegin( int serverHandle )
+  protected static native long getKeysBegin( long serverHandle )
     throws AFSException;
 
   /**
@@ -1678,7 +1684,7 @@ public class Server implements Serializable, Comparable
    * @return 0 if there are no more keys, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getKeysNext( int iterationId, Key theKey )
+  protected static native int getKeysNext( long iterationId, Key theKey )
     throws AFSException;
 
   /**
@@ -1688,7 +1694,7 @@ public class Server implements Serializable, Comparable
    * @see #getKeysBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getKeysDone( int iterationId )
+  protected static native void getKeysDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1701,7 +1707,7 @@ public class Server implements Serializable, Comparable
    * @exception AFSException  If an error occurs in the native code
    * @see #getVosServerHandle
    */
-  protected static native int getBosAdminCount( int serverHandle )
+  protected static native int getBosAdminCount( long serverHandle )
     throws AFSException;
 
   /**
@@ -1715,7 +1721,7 @@ public class Server implements Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getBosAdminsBegin( int serverHandle )
+  protected static native long getBosAdminsBegin( long serverHandle )
     throws AFSException;
 
   /**
@@ -1727,7 +1733,7 @@ public class Server implements Serializable, Comparable
    * @return the name of the next admin of the server
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getBosAdminsNextString( int iterationId )
+  protected static native String getBosAdminsNextString( long iterationId )
     throws AFSException;
 
   /**
@@ -1735,15 +1741,15 @@ public class Server implements Serializable, Comparable
    * are no more admins, != 0 otherwise.
    *
    * @param cellHandle    the handle of the cell to which these admins belong
-   * @see Cell#getCellHandle
+   * @see #getCellHandle
    * @param iterationId   the iteration ID of this iteration
    * @see #getBosAdminsBegin
    * @param theUser   the user object in which to fill the values of this admin
    * @return 0 if no more admins, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getBosAdminsNext( int cellHandle, 
-                                               int iterationId, User theUser )
+  protected static native int getBosAdminsNext( long cellHandle, 
+                                               long iterationId, User theUser )
     throws AFSException;
 
   /**
@@ -1753,7 +1759,7 @@ public class Server implements Serializable, Comparable
    * @see #getBosAdminsBegin
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void getBosAdminsDone( int iterationId )
+  protected static native void getBosAdminsDone( long iterationId )
     throws AFSException;
 
   /**
@@ -1765,7 +1771,7 @@ public class Server implements Serializable, Comparable
    * @param adminName   the name of the admin to add to the list
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void addBosAdmin( int serverHandle, 
+  protected static native void addBosAdmin( long serverHandle, 
                                            String adminName )
     throws AFSException;
 
@@ -1779,7 +1785,7 @@ public class Server implements Serializable, Comparable
    * @param adminName   the name of the admin to remove from the list
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void removeBosAdmin( int serverHandle, 
+  protected static native void removeBosAdmin( long serverHandle, 
                                               String adminName )
     throws AFSException;
 
@@ -1787,7 +1793,7 @@ public class Server implements Serializable, Comparable
    * Salvages (restores consistency to) a volume, partition, or server
    *
    * @param cellHandle    the handle of the cell to which the volume belongs
-   * @see Cell#getCellHandle
+   * @see #getCellHandle
    * @param serverHandle  the bos handle of the server on which the 
    *                      volume resides
    * @see #getBosServerHandle
@@ -1815,7 +1821,7 @@ public class Server implements Serializable, Comparable
    *                          one block at a time and skip badly damaged 
    *                          blocks.  Use if partition has disk errors
    */
-  protected static native void salvage( int cellHandle, int serverHandle, 
+  protected static native void salvage( long cellHandle, long serverHandle, 
                                        String partitionName, String volName,
                                        int numSalvagers, String tempDir, 
                                        String logFile, 
@@ -1831,14 +1837,14 @@ public class Server implements Serializable, Comparable
    *  Synchronizes a particular server with the volume location database.
    *
    * @param cellHandle    the handle of the cell to which the server belongs
-   * @see Cell#getCellHandle
+   * @see #getCellHandle
    * @param serverHandle  the vos handle of the server     
    * @see #getVosServerHandle
    * @param partition   the id of the partition to sync, can be -1 to ignore
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void syncServerWithVLDB( int cellHandle, 
-                                                  int serverHandle, 
+  protected static native void syncServerWithVLDB( long cellHandle, 
+                                                  long serverHandle, 
                                                   int partition )
     throws AFSException;
 
@@ -1846,15 +1852,15 @@ public class Server implements Serializable, Comparable
    *  Synchronizes the volume location database with a particular server.
    *
    * @param cellHandle    the handle of the cell to which the server belongs
-   * @see Cell#getCellHandle
+   * @see #getCellHandle
    * @param serverHandle  the vos handle of the server     
    * @see #getVosServerHandle
    * @param partition   the id of the partition to sync, can be -1 to ignore
    * @param forceDeletion   whether or not to force the deletion of bad volumes
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void syncVLDBWithServer( int cellHandle, 
-                                                  int serverHandle, 
+  protected static native void syncVLDBWithServer( long cellHandle, 
+                                                  long serverHandle, 
                                                   int partition, 
                                                   boolean forceDeletion )
     throws AFSException;
@@ -1869,7 +1875,7 @@ public class Server implements Serializable, Comparable
    * @param logLocation   the full path and name of the desired bos log
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native String getLog( int serverHandle, String logLocation )
+  protected static native String getLog( long serverHandle, String logLocation )
     throws AFSException;
 
   /**
@@ -1886,7 +1892,7 @@ public class Server implements Serializable, Comparable
    *                    the restart time fields
    * @exception AFSException  If an error occurs in the native code
    */
-  private static native void getRestartTime( int serverHandle, 
+  private static native void getRestartTime( long serverHandle, 
                                               int restartType, 
                                               ExecutableTime executableTime )
     throws AFSException;
@@ -1903,7 +1909,7 @@ public class Server implements Serializable, Comparable
    * @param theServer   the server object containing the desired information
    * @exception AFSException  If an error occurs in the native code
    */
-  private static native void setRestartTime( int serverHandle, 
+  private static native void setRestartTime( long serverHandle, 
                                               int restartType, 
                                               ExecutableTime executableTime )
     throws AFSException;
@@ -1916,7 +1922,7 @@ public class Server implements Serializable, Comparable
    * @see #getBosServerHandle
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void startAllProcesses( int serverHandle )
+  protected static native void startAllProcesses( long serverHandle )
     throws AFSException;
 
   /**
@@ -1928,7 +1934,7 @@ public class Server implements Serializable, Comparable
    * @param restartBosServer   whether or not to restart the bos server as well
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void restartAllProcesses( int serverHandle, 
+  protected static native void restartAllProcesses( long serverHandle, 
                                                    boolean restartBosServer )
     throws AFSException;
 
@@ -1940,7 +1946,7 @@ public class Server implements Serializable, Comparable
    * @see #getBosServerHandle
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void stopAllProcesses( int serverHandle )
+  protected static native void stopAllProcesses( long serverHandle )
     throws AFSException;
 
   /**
index 5626a71..ae7b7da 100644 (file)
@@ -91,7 +91,7 @@ public class Token implements Serializable, Comparable
 {
   public static int ANYUSER_PAG_ID;
 
-  protected int tokenHandle;
+  protected long tokenHandle;
   protected int pagID = -1;
   protected int errno;
 
@@ -161,7 +161,7 @@ public class Token implements Serializable, Comparable
     this.password = password;
     this.cellName = cellName;
 
-System.out.println(username + ", " + cellName);
+//System.out.println(username + ", " + cellName);
     /* By default lets authenticate the user using libafsauthent.a */
     login();
   }
@@ -196,7 +196,7 @@ System.out.println(username + ", " + cellName);
    * @exception AFSException  If an error occurs in the native code
    * @return a token representing the authentication
    */
-  protected int getHandle()
+  protected long getHandle()
   {
     return tokenHandle;
   }
@@ -250,6 +250,7 @@ System.out.println(username + ", " + cellName);
   public void login() throws AFSException
   {
     this.tokenHandle = this.getToken(cellName, username, password);
+//System.out.println("Token handle -> " + tokenHandle);
   }
 
   /**
@@ -355,7 +356,7 @@ System.out.println(username + ", " + cellName);
    * @exception AFSException  If an error occurs in the native code
    * @return a token representing the authentication
    */
-  protected native int getToken( String cellName, String username, 
+  protected native long getToken( String cellName, String username, 
                                  String password ) 
        throws AFSException;
 
@@ -365,7 +366,7 @@ System.out.println(username + ", " + cellName);
    * @param tokenHandle   the token to close
    * @exception AFSException  If an error occurs in the native code
    */
-  protected native void close( int tokenHandle ) throws AFSException;
+  protected native void close( long tokenHandle ) throws AFSException;
 
   /**
    *  Gets the expiration time for a given token.
@@ -376,7 +377,7 @@ System.out.println(username + ", " + cellName);
    * @return a long representing the UTC time for the token expiration
    * @exception AFSException  If an error occurs in the native code
    */
-  protected native long getExpiration( int tokenHandle )
+  protected native long getExpiration( long tokenHandle )
       throws AFSException;
 
   /**
index 5427157..fdda30f 100644 (file)
@@ -160,7 +160,7 @@ public class User implements PTSEntry, Serializable, Comparable
   public static final int NO_REUSE_PASSWORD = 1;
 
   protected Cell cell;
-  protected int cellHandle;
+  protected long cellHandle;
   protected String name;
 
   /**
@@ -542,7 +542,7 @@ public class User implements PTSEntry, Serializable, Comparable
   protected void refreshGroupNames() throws AFSException
   {
     String currName;
-    int iterationID = getUserGroupsBegin( cell.getCellHandle(), name );
+    long iterationID = getUserGroupsBegin( cell.getCellHandle(), name );
     groupNames = new ArrayList();
     while( ( currName = getUserGroupsNextString( iterationID ) ) != null ) {
       groupNames.add( currName );
@@ -560,7 +560,7 @@ public class User implements PTSEntry, Serializable, Comparable
   protected void refreshGroups() throws AFSException
   {
     Group currGroup;
-    int iterationID = getUserGroupsBegin( cell.getCellHandle(), name );
+    long iterationID = getUserGroupsBegin( cell.getCellHandle(), name );
 
     groups = new ArrayList();
 
@@ -582,7 +582,7 @@ public class User implements PTSEntry, Serializable, Comparable
   protected void refreshGroupsOwnedNames() throws AFSException
   {
     String currName;
-    int iterationID = this.getGroupsOwnedBegin( cell.getCellHandle(), name );
+    long iterationID = this.getGroupsOwnedBegin( cell.getCellHandle(), name );
     groupsOwnedNames = new ArrayList();
     while( ( currName = this.getGroupsOwnedNextString( iterationID ) ) 
           != null ) {
@@ -601,7 +601,7 @@ public class User implements PTSEntry, Serializable, Comparable
   protected void refreshGroupsOwned() throws AFSException
   {
     Group currGroup;
-    int iterationID = getGroupsOwnedBegin( cell.getCellHandle(), name );
+    long iterationID = getGroupsOwnedBegin( cell.getCellHandle(), name );
     groupsOwned = new ArrayList();
     currGroup = new Group( cell );
     while( getGroupsOwnedNext( cellHandle, iterationID, currGroup ) != 0 ) {
@@ -1288,7 +1288,7 @@ public class User implements PTSEntry, Serializable, Comparable
     if( (value != this.USER_OWNER_ACCESS) && 
        (value != this.USER_ANYUSER_ACCESS) ) {
        throw new IllegalArgumentException( "Cannot set listStatus to " 
-                                          + value );
+                                           + value );
     } else {
        listStatus = value;
     }
@@ -1313,7 +1313,7 @@ public class User implements PTSEntry, Serializable, Comparable
     if( (value != this.USER_OWNER_ACCESS) && 
        (value != this.USER_ANYUSER_ACCESS) ) {
        throw new IllegalArgumentException( "Cannot set listGroupsOwned to " 
-                                          + value );
+                                           + value );
     } else {
        listGroupsOwned = value;
     }
@@ -1339,7 +1339,7 @@ public class User implements PTSEntry, Serializable, Comparable
     if( (value != this.USER_OWNER_ACCESS) && 
        (value != this.USER_ANYUSER_ACCESS) ) {
        throw new IllegalArgumentException( "Cannot set listMembership to " 
-                                          + value );
+                                           + value );
     } else {
        listMembership = value;
     }
@@ -1503,7 +1503,7 @@ public class User implements PTSEntry, Serializable, Comparable
    *
    * @return a <code>String</code> representation of the <code>User</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
     String r;
     try {
@@ -1624,7 +1624,7 @@ public class User implements PTSEntry, Serializable, Comparable
    * @return    a <code>String</code> representation of the groups belonged to
    * @see       Group#toString
    */
-  protected String getInfoGroups() throws AFSException
+  public String getInfoGroups() throws AFSException
   {
        String r;
        r = "User: " + name + "\n\n";
@@ -1644,7 +1644,7 @@ public class User implements PTSEntry, Serializable, Comparable
    * @return    a <code>String</code> representation of the groups owned
    * @see       Group#toString
    */
-  protected String getInfoGroupsOwned() throws AFSException
+  public String getInfoGroupsOwned() throws AFSException
   {
        String r;
        r = "User: " + name + "\n\n";
@@ -1723,8 +1723,8 @@ public class User implements PTSEntry, Serializable, Comparable
    *                automatically assigned)
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void create( int cellHandle, String userName, 
-                                       String password, int uid )
+  protected static native void create( long cellHandle, String userName, 
+                                      String password, int uid )
        throws AFSException;
 
   /**
@@ -1737,7 +1737,7 @@ public class User implements PTSEntry, Serializable, Comparable
    * @param groupName      the name of the user to delete
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void delete( int cellHandle, String userName )
+  protected static native void delete( long cellHandle, String userName )
        throws AFSException;
 
   /**
@@ -1748,7 +1748,7 @@ public class User implements PTSEntry, Serializable, Comparable
    * @param groupName      the name of the user to unlock
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native void unlock( int cellHandle, String userName )
+  protected static native void unlock( long cellHandle, String userName )
        throws AFSException;
 
   /**
@@ -1763,8 +1763,8 @@ public class User implements PTSEntry, Serializable, Comparable
    * @see User
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getUserInfo( int cellHandle, String name, 
-                                            User user ) 
+  protected static native void getUserInfo( long cellHandle, String name, 
+                                           User user ) 
        throws AFSException;
 
   /**
@@ -1778,8 +1778,8 @@ public class User implements PTSEntry, Serializable, Comparable
    *                 information
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void setUserInfo( int cellHandle, String name, 
-                                            User theUser ) 
+  protected static native void setUserInfo( long cellHandle, String name, 
+                                           User theUser ) 
        throws AFSException;
 
   /**
@@ -1792,8 +1792,8 @@ public class User implements PTSEntry, Serializable, Comparable
    * @param newName     the new name for the user
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void rename( int cellHandle, String oldName, 
-                                       String newName )
+  protected static native void rename( long cellHandle, String oldName, 
+                                      String newName )
        throws AFSException;
 
   /**
@@ -1805,8 +1805,8 @@ public class User implements PTSEntry, Serializable, Comparable
    * @param newPassword     the new password for the user
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void setPassword( int cellHandle, String userName, 
-                                            String newPassword )
+  protected static native void setPassword( long cellHandle, String userName, 
+                                           String newPassword )
        throws AFSException;
 
   /**
@@ -1820,7 +1820,7 @@ public class User implements PTSEntry, Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native int getUserGroupsBegin( int cellHandle, String name )
+  protected static native long getUserGroupsBegin( long cellHandle, String name )
        throws AFSException;
 
   /**
@@ -1828,11 +1828,11 @@ public class User implements PTSEntry, Serializable, Comparable
    * <code>null</code> if there are no more groups.
    *
    * @param iterationId   the iteration ID of this iteration
-   * @see #getUserGroupsBegin
+   * @see getUserGroupsBegin
    * @return the name of the next group
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native String getUserGroupsNextString( int iterationId )
+  protected static native String getUserGroupsNextString( long iterationId )
        throws AFSException;
 
   /**
@@ -1842,25 +1842,25 @@ public class User implements PTSEntry, Serializable, Comparable
    * @param cellHandle    the handle of the cell to which the users belong
    * @see Cell#getCellHandle
    * @param iterationId   the iteration ID of this iteration
-   * @see #getUserGroupsBegin
+   * @see getUserGroupsBegin
    * @param theGroup   a Group object to be populated with the values of the 
    *                   next group
    * @return 0 if there are no more users, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getUserGroupsNext( int cellHandle, 
-                                                 int iterationId, 
-                                                 Group theGroup )
+  protected static native int getUserGroupsNext( long cellHandle, 
+                                                long iterationId, 
+                                                Group theGroup )
     throws AFSException;
 
   /**
    * Signals that the iteration is complete and will not be accessed anymore.
    *
    * @param iterationId   the iteration ID of this iteration
-   * @see #getUserGroupsBegin
+   * @see getUserGroupsBegin
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getUserGroupsDone( int iterationId )
+  protected static native void getUserGroupsDone( long iterationId )
        throws AFSException;
 
   /**
@@ -1872,7 +1872,7 @@ public class User implements PTSEntry, Serializable, Comparable
    * @exception AFSException   If an error occurs in the native code
    * @see Cell#getCellHandle
    */
-  protected static native int getGroupsOwnedCount( int cellHandle, String name )
+  protected static native int getGroupsOwnedCount( long cellHandle, String name )
        throws AFSException;
 
   /**
@@ -1886,8 +1886,8 @@ public class User implements PTSEntry, Serializable, Comparable
    * @return an iteration ID
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native int getGroupsOwnedBegin( int cellHandle, 
-                                                   String name )
+  protected static native long getGroupsOwnedBegin( long cellHandle, 
+                                                  String name )
        throws AFSException;
 
   /**
@@ -1895,11 +1895,11 @@ public class User implements PTSEntry, Serializable, Comparable
    * if there are no more groups.
    *
    * @param iterationId   the iteration ID of this iteration
-   * @see #getGroupsOwnedBegin
+   * @see getGroupsOwnedBegin
    * @return the name of the next group
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native String getGroupsOwnedNextString( int iterationId )
+  protected static native String getGroupsOwnedNextString( long iterationId )
        throws AFSException;
 
   /**
@@ -1909,25 +1909,25 @@ public class User implements PTSEntry, Serializable, Comparable
    * @param cellHandle    the handle of the cell to which the users belong
    * @see Cell#getCellHandle
    * @param iterationId   the iteration ID of this iteration
-   * @see #getGroupsOwnedBegin
+   * @see getGroupsOwnedBegin
    * @param theGroup   a Group object to be populated with the values of the 
    *                   next group
    * @return 0 if there are no more users, != 0 otherwise
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int getGroupsOwnedNext( int cellHandle, 
-                                                                 int iterationId, 
-                                                         Group theGroup )
+  protected static native int getGroupsOwnedNext( long cellHandle, 
+                                                 long iterationId, 
+                                                 Group theGroup )
     throws AFSException;
 
   /**
    * Signals that the iteration is complete and will not be accessed anymore.
    *
    * @param iterationId   the iteration ID of this iteration
-   * @see #getGroupsOwnedBegin
+   * @see getGroupsOwnedBegin
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getGroupsOwnedDone( int iterationId )
+  protected static native void getGroupsOwnedDone( long iterationId )
        throws AFSException;
 
   /**
@@ -1937,3 +1937,12 @@ public class User implements PTSEntry, Serializable, Comparable
    */
   protected static native void reclaimUserMemory();
 }
+
+
+
+
+
+
+
+
+
diff --git a/src/JAVA/classes/org/openafs/jafs/VersionInfo.java b/src/JAVA/classes/org/openafs/jafs/VersionInfo.java
new file mode 100644 (file)
index 0000000..ccf521f
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * @(#)VersionInfo.java        1.0 05/09/2005
+ *
+ * Copyright (c) 2001 International Business Machines Corp.
+ * All rights reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.openafs.jafs;
+
+/**
+ * Provides version information about the native C library and the JAVA side.
+ *
+ * At least a <<Class.forName("org.openafs.jafs.Token");>> is necessary before using these methods.
+ * Perhaps a redesign would be required because the library initialization occures only in Token.java.
+ */
+public class VersionInfo
+{
+  /**
+   * Returns java interface version string
+   * the native library version should be higher
+   */
+  public static String getVersionOfJavaInterface() {return "20050905";}
+
+  /**
+   * Returns the native library version
+   *
+   * @exception AFSException if internal (libjafs, libjafsadmin) versions differ
+   */
+  public static String getVersionOfLibrary() throws AFSException
+  {
+       String ver = getVersionOfLibjafs();
+       if (!ver.equals(getVersionOfLibjafsadm()))
+               throw new AFSException("library versions differ", 0);
+       return ver;
+  }
+
+  /**
+   * Returns build information of the native library.
+   * This information is autogenerated by the openafs make system.
+   * Example: "@(#) OpenAFS 1.3.87 built  2005-09-06 "
+   *
+   * @exception AFSException if internal (libjafs, libjafsadmin) versions differ
+   */
+  public static String getBuildInfo() throws AFSException
+  {
+       String info = getBuildInfoOfLibjafs();
+       if (!info.equals(getBuildInfoOfLibjafsadm()))
+               throw new AFSException("library build info differ", 0);
+       return info;
+  }
+
+  private static native String getVersionOfLibjafs();
+  private static native String getVersionOfLibjafsadm();
+  private static native String getBuildInfoOfLibjafs();
+  private static native String getBuildInfoOfLibjafsadm();
+}
index 85fe4ca..2ef2ade 100644 (file)
@@ -315,7 +315,7 @@ public class Volume implements Serializable, Comparable
   protected void refreshInfo() throws AFSException
   {
     getVolumeInfo( cell.getCellHandle(), server.getVosHandle(), 
-                   partition.getID(), getID(), this );
+                  partition.getID(), getID(), this );
     cachedInfo = true;
     creationDateCal = null;
     lastUpdateDateCal = null;
@@ -333,7 +333,7 @@ public class Volume implements Serializable, Comparable
   public void create( int quota ) throws AFSException
   {
     id = create( cell.getCellHandle(), server.getVosHandle(), 
-                 partition.getID(), name, quota );
+                partition.getID(), name, quota );
     maxQuota = quota;
   }
 
@@ -366,7 +366,7 @@ public class Volume implements Serializable, Comparable
   {
     Server siteServer = sitePartition.getServer();
     createReadOnlyVolume( cell.getCellHandle(), siteServer.getVosHandle(), 
-                          sitePartition.getID(), getID() );
+                         sitePartition.getID(), getID() );
     release( false );
     return new Volume( name + ".readonly", sitePartition );
   }
@@ -379,7 +379,7 @@ public class Volume implements Serializable, Comparable
   public void delete() throws AFSException
   {
     delete( cell.getCellHandle(), server.getVosHandle(), partition.getID(), 
-            getID() );
+           getID() );
     name = null;
     creationDateCal = null;
     lastUpdateDateCal = null;
@@ -434,7 +434,7 @@ public class Volume implements Serializable, Comparable
       startTime = (int) ((dumpSince.getTime().getTime())/((long) 1000));
     }
     dump( cell.getCellHandle(), server.getVosHandle(), partition.getID(), 
-          getID(), startTime, fileName );
+         getID(), startTime, fileName );
   }
 
   /**
@@ -485,7 +485,7 @@ public class Volume implements Serializable, Comparable
       throws AFSException
   {
     restore( cell.getCellHandle(), server.getVosHandle(), partition.getID(), 
-             id, name, fileName, incremental );
+            id, name, fileName, incremental );
   }
 
   /**
@@ -541,7 +541,7 @@ public class Volume implements Serializable, Comparable
   {
     Server newServer = newPartition.getServer();
     move( cell.getCellHandle(), server.getVosHandle(), partition.getID(), 
-          newServer.getVosHandle(), newPartition.getID(), getID() );
+         newServer.getVosHandle(), newPartition.getID(), getID() );
 
     server = newServer;
     partition = newPartition;
@@ -568,8 +568,8 @@ public class Volume implements Serializable, Comparable
   public void salvage() throws AFSException
   {
     Server.salvage( cell.getCellHandle(), server.getBosHandle(), 
-                    partition.getName(), name, 4, null, null, false, false, 
-                    false, false, false, false );
+                   partition.getName(), name, 4, null, null, false, false, 
+                   false, false, false, false );
   }
 
   /**
@@ -598,7 +598,7 @@ public class Volume implements Serializable, Comparable
     throws AFSException
   {
     Cell.createMountPoint( cell.getCellHandle(), directory, getName(), 
-                           readWrite, false ); 
+                          readWrite, false ); 
   }
 
   //////////////// accessors:  ////////////////////////
@@ -847,7 +847,7 @@ public class Volume implements Serializable, Comparable
     if ( !cachedInfo ) refreshInfo();
     if (maxQuota == 0) {
       throw new AFSException("Volume with id " + id + 
-                             " has an unlimited quota configured.", 0);
+                                  " has an unlimited quota configured.", 0);
     }
     return maxQuota;
   }
@@ -954,7 +954,7 @@ public class Volume implements Serializable, Comparable
   public void setQuota( int quota ) throws AFSException
   {
     this.changeQuota( cell.getCellHandle(), server.getVosHandle(), 
-                      partition.getID(), getID(), quota );
+                     partition.getID(), getID(), quota );
     maxQuota = quota;
   }
 
@@ -966,7 +966,7 @@ public class Volume implements Serializable, Comparable
    *
    * @return a <code>String</code> representation of the <code>Volume</code>
    */
-  protected String getInfo()
+  public String getInfo()
   {
       String r;
       try {
@@ -1096,9 +1096,9 @@ public class Volume implements Serializable, Comparable
    *                    the information
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void getVolumeInfo( int cellHandle, int serverHandle,
-                                              int partition, int volId, 
-                                              Volume theVolume ) 
+  protected static native void getVolumeInfo( long cellHandle, long serverHandle,
+                                             int partition, int volId, 
+                                             Volume theVolume ) 
        throws AFSException;
 
   /**
@@ -1116,9 +1116,9 @@ public class Volume implements Serializable, Comparable
    * @return the numeric ID assigned to the volume
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native int create( int cellHandle, int serverHandle, 
-                                      int partition, String volumeName, 
-                                      int quota ) 
+  protected static native int create( long cellHandle, long serverHandle, 
+                                     int partition, String volumeName, 
+                                     int quota ) 
        throws AFSException;
 
   /**
@@ -1134,8 +1134,8 @@ public class Volume implements Serializable, Comparable
    * @param volId   the numeric id of the volume to delete
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void delete( int cellHandle, int serverHandle, 
-                                       int partition, int volId ) 
+  protected static native void delete( long cellHandle, long serverHandle, 
+                                      int partition, int volId ) 
        throws AFSException;
 
   /**
@@ -1146,7 +1146,7 @@ public class Volume implements Serializable, Comparable
    *               volume
    * @see Cell#getCellHandle
    */
-  protected static native void createBackupVolume( int cellHandle, int volId )
+  protected static native void createBackupVolume( long cellHandle, int volId )
        throws AFSException;
 
   /**
@@ -1161,9 +1161,9 @@ public class Volume implements Serializable, Comparable
    * @param volId  the numeric id of the volume for which to create a read-only volume
    * @see Cell#getCellHandle
    */
-  protected static native void createReadOnlyVolume( int cellHandle, 
-                                                     int serverHandle, 
-                                                     int partition, int volId )
+  protected static native void createReadOnlyVolume( long cellHandle, 
+                                                    long serverHandle, 
+                                                    int partition, int volId )
        throws AFSException;
 
   /**
@@ -1179,9 +1179,9 @@ public class Volume implements Serializable, Comparable
    *               delete the read-only volume
    * @see Cell#getCellHandle
    */
-  protected static native void deleteReadOnlyVolume( int cellHandle, 
-                                                     int serverHandle, 
-                                                     int partition, int volId )
+  protected static native void deleteReadOnlyVolume( long cellHandle, 
+                                                    long serverHandle, 
+                                                    int partition, int volId )
        throws AFSException;
 
   /**
@@ -1198,9 +1198,9 @@ public class Volume implements Serializable, Comparable
    * @param newQuota    the new quota (in KB) to assign the volume
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void changeQuota( int cellHandle, int serverHandle, 
-                                            int partition, int volId, 
-                                            int newQuota ) 
+  protected static native void changeQuota( long cellHandle, long serverHandle, 
+                                           int partition, int volId, 
+                                           int newQuota ) 
        throws AFSException;
 
   /**
@@ -1220,9 +1220,9 @@ public class Volume implements Serializable, Comparable
    * @param volId  the numeric id of the volume to move
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void move( int cellHandle, int fromServerHandle, 
-                                     int fromPartition, int toServerHandle, 
-                                     int toPartition, int volId ) 
+  protected static native void move( long cellHandle, long fromServerHandle, 
+                                    int fromPartition, long toServerHandle, 
+                                    int toPartition, int volId ) 
        throws AFSException;
 
   /**
@@ -1233,8 +1233,8 @@ public class Volume implements Serializable, Comparable
    * @param forceComplete  whether or not to force a complete release
    * @see Cell#getCellHandle
    */
-  protected static native void release( int cellHandle, int volId, 
-                                        boolean forceComplete )
+  protected static native void release( long cellHandle, int volId, 
+                                       boolean forceComplete )
        throws AFSException;
 
   /**
@@ -1253,9 +1253,9 @@ public class Volume implements Serializable, Comparable
    * @param dumpFile   the full path of the file to which to dump
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void dump( int cellHandle, int serverHandle, 
-                                     int partition, int volId, int startTime, 
-                                     String dumpFile ) 
+  protected static native void dump( long cellHandle, long serverHandle, 
+                                    int partition, int volId, int startTime, 
+                                    String dumpFile ) 
        throws AFSException;
 
   /**
@@ -1277,10 +1277,10 @@ public class Volume implements Serializable, Comparable
    *                     otherwise restores a full dump
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void restore( int cellHandle, int serverHandle, 
-                                        int partition, int volId, 
-                                        String volumeName, String dumpFile, 
-                                        boolean incremental ) 
+  protected static native void restore( long cellHandle, long serverHandle, 
+                                       int partition, int volId, 
+                                       String volumeName, String dumpFile, 
+                                       boolean incremental ) 
        throws AFSException;
 
   /**
@@ -1292,8 +1292,8 @@ public class Volume implements Serializable, Comparable
    * @param newVolumeName  the new name for the volume
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void rename( int cellHandle, int volId, 
-                                       String newVolumeName ) 
+  protected static native void rename( long cellHandle, int volId, 
+                                      String newVolumeName ) 
        throws AFSException;
 
   /**
@@ -1311,9 +1311,9 @@ public class Volume implements Serializable, Comparable
    *                     status of the volume -- busy or offline)
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void mount( int serverHandle, int partition, 
-                                      int volId, int sleepTime, 
-                                      boolean offline ) 
+  protected static native void mount( long serverHandle, int partition, 
+                                     int volId, int sleepTime, 
+                                     boolean offline ) 
        throws AFSException;
 
   /**
@@ -1327,8 +1327,8 @@ public class Volume implements Serializable, Comparable
    * @param volId  the numeric id of the volume to bring offline
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void unmount( int serverHandle, int partition, 
-                                        int volId ) 
+  protected static native void unmount( long serverHandle, int partition, 
+                                       int volId ) 
        throws AFSException;
 
   /**
@@ -1339,7 +1339,7 @@ public class Volume implements Serializable, Comparable
    * @param volId  the numeric id of the volume to lock
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void lock( int cellHandle, int volId ) 
+  protected static native void lock( long cellHandle, int volId ) 
        throws AFSException;
 
   /**
@@ -1350,7 +1350,7 @@ public class Volume implements Serializable, Comparable
    * @param volId  the numeric id of the volume to unlock
    * @exception AFSException   If an error occurs in the native code
    */
-  protected static native void unlock( int cellHandle, int volId ) 
+  protected static native void unlock( long cellHandle, int volId ) 
        throws AFSException;
 
   /**
@@ -1368,8 +1368,8 @@ public class Volume implements Serializable, Comparable
    * @return   the id of the volume in question
    * @exception AFSException  If an error occurs in the native code
    */
-  protected static native int translateNameToID( int cellHandle, String name, 
-                                                 int volumeType )
+  protected static native int translateNameToID( long cellHandle, String name, 
+                                                int volumeType )
     throws AFSException;
 
   /**
@@ -1379,3 +1379,16 @@ public class Volume implements Serializable, Comparable
    */
   protected static native void reclaimVolumeMemory();
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/JAVA/classes/testAFS.java b/src/JAVA/classes/testAFS.java
new file mode 100644 (file)
index 0000000..c0110a9
--- /dev/null
@@ -0,0 +1,684 @@
+import java.io.File;
+import java.util.GregorianCalendar;
+
+import org.openafs.jafs.*;
+
+
+
+/**
+ * @version    1.0
+ * @author
+ */
+public class testAFS
+{
+       public class TesterThread implements Runnable
+       {
+               private String user = null;
+               private String pass = null;
+               private String cell = null;
+               private boolean letItRun = true;
+
+               public TesterThread(String user, String pass, String cell)
+               {
+                       this.user = user;
+                       this.pass = pass;
+                       this.cell = cell;
+               }
+               public void finish()
+               {
+                       letItRun = false;
+               }
+               public void run()
+               {
+                       while(letItRun)
+                       {
+                               try
+                               {
+                                       Token t = new Token(user, pass, cell);
+                                       Cell c = new Cell(t, false);
+                                       c.getInfo();
+       
+                                       for(int j=0; j<100; j++)
+                                       {
+                                               ACL acl = new ACL("/afs/." + cell, true);
+                                       }
+
+                                       c.close();
+                               } catch(Exception e) {
+                                       e.printStackTrace();
+                               }
+                               Thread.yield();
+                       }
+               }
+       }
+       
+       
+       static java.io.PrintStream out = System.out;
+       static String firstCellPathRW = null;
+
+       static boolean allowDump = true;
+       
+       static int ident = 0;
+
+       static void DumpBegin()
+       {
+               if (allowDump)
+               {
+                       for(int i=0; i<ident; i++)
+                               out.print("   ");
+               }
+       }
+       static void Dump(String str)
+       {
+               if (allowDump)
+                       out.print(str);
+       }
+       static void DumpEnd()
+       {
+               if (allowDump)
+                       out.println();
+       }
+       static void DumpLn(String str)
+       {
+               DumpBegin();
+               Dump(str);
+               DumpEnd();
+       }
+
+       public static String getGregDateStr(GregorianCalendar gc)
+       {
+               if (gc==null)
+                       return "null";
+               else
+                       return gc.getTime().toString();
+       }
+
+       public static void DumpToken(Token t)
+       {
+               try
+               {
+                       DumpLn("Token: user=" + t.getUsername() +
+                                       " cell=" + t.getCellName() + " expiration=" + t.getExpiration());
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void DumpFile(org.openafs.jafs.File f)
+       {
+               try
+               {
+                       DumpBegin();
+                       f.refresh();
+                       Dump("File name: " + f.getPath() + ": ");
+                       if (f.isDirectory()) {
+                               Dump("This is a directory.");
+                       } else if (f.isLink()) {
+                               Dump("This is a symbolic-link.");
+                               Dump(" Its target is: " + f.getTarget());
+                               f.validate();
+                               if (f.isFile()) {
+                                       Dump(" This object is now a file!");
+                               } else if (f.isDirectory()) {
+                                       Dump(" This object is now a directory!");
+                               } else if (f.isMountPoint()) {
+                                       Dump(" This object is now a volume mount point!");
+                               }
+                       } else if (f.isMountPoint()) {
+                               Dump(" This is a volume mount point.");
+                       } else if (f.isFile()) {
+                               Dump(" This is a file. Size: " + f.length());
+                       }
+                       DumpEnd();
+
+                       ACL acl = new ACL(f.getPath());
+                       ident++;
+                       DumpLn(acl.toString());
+                       ident--;
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void DumpCell(Cell cell)
+       {
+               try
+               {
+                       DumpLn("Cell: " + cell.getName());
+                       ident++;
+                       DumpLn("MaxGroupID: " + cell.getMaxGroupID());
+                       DumpLn("MaxUserID: " + cell.getMaxUserID());
+                       ident--;
+       
+                       //test some queries, don't write to output
+                       cell.getInfo();
+                       cell.getInfoGroups();
+                       cell.getInfoServers();
+                       cell.getInfoUsers();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void DumpServer(Server s)
+       {
+               DumpLn("Server: " + s.getName());
+               ident++;
+               try
+               {
+                       try //pServer'SLES9 bug:
+                       {
+                               DumpLn("BinaryRestartTime: " + s.getBinaryRestartTime());
+                       } catch(AFSException e) {
+                               e.printStackTrace();
+                       }
+                       DumpLn("TotalFreeSpace:" + s.getTotalFreeSpace());
+                       DumpLn("TotalSpace:" + s.getTotalSpace());
+                       DumpLn("TotalUsedSpace:" + s.getTotalUsedSpace());
+                       DumpLn("GeneralRestartTime:" + s.getGeneralRestartTime());
+                       DumpBegin();
+                       Dump("ip addresses: ");
+                       String[] ipAddrs = s.getIPAddresses();
+                       for(int i=0; i<ipAddrs.length; i++)
+                       {
+                               Dump(ipAddrs[i] + " ");
+                       }
+                       DumpEnd();
+                       DumpBegin();
+                       Dump("isFileServer: " + s.isFileServer());
+                       Dump(" isBadFileserver: " + s.isBadFileServer());
+                       Dump(" isDatabase: " + s.isDatabase());
+                       Dump(" isBadDatabase: " + s.isBadDatabase());
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }                       
+               ident--;
+
+               try
+               {
+                       //test some queries, don't write to output
+                       s.getInfo();
+                       try
+                       {
+                               s.getInfoKeys();
+                       } catch(AFSException e) {
+                               e.printStackTrace();
+                       }
+                       try     //is there any partitions? why parts can be null...
+                       {       //wrong programming concept: null instead of an empty array !!!
+                               s.getInfoPartitions();
+                       } catch(Exception e) {
+                               e.printStackTrace();
+                       }
+                       s.getInfoProcesses();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void DumpVolume(Volume v)
+       {
+               try
+               {
+                       DumpBegin();
+                       Dump("Volume name: " + v.getName());
+                       Dump(" ID: " + v.getID());
+                       DumpEnd();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+
+               ident++;
+               try
+               {
+                       DumpBegin();
+                       Dump("BackupID: " + v.getBackupID());
+                       Dump(" ReadOnlyID: " + v.getReadOnlyID());
+                       Dump(" ReadWriteID: " + v.getReadWriteID());
+                       DumpEnd();
+                       DumpBegin();
+                       Dump("LastUpdateDate: " + getGregDateStr(v.getLastUpdateDate()));
+                       Dump(" CreationDate: " + getGregDateStr(v.getCreationDate()));
+                       Dump(" AccessesSinceMidnight: " + v.getAccessesSinceMidnight());
+                       DumpEnd();
+                       DumpBegin();
+                       Dump("FileCount: " + v.getFileCount());
+                       Dump(" CurrentSize: " + v.getCurrentSize());
+                       Dump(" TotalFreeSpace: " + v.getTotalFreeSpace());
+                       DumpEnd();
+                       DumpBegin();
+                       Dump("Type: " + v.getType());
+                       Dump(" Disposition: " + v.getDisposition());
+                       DumpEnd();
+                       
+                       //test some queries, don't write to output
+                       v.getInfo();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               ident--;
+       }
+
+       public static void DumpPartition(Partition p)
+       {
+               try
+               {
+                       DumpBegin();
+                       Dump("Partition name: " + p.getName());
+                       Dump(" ID: " + p.getID());
+                       Dump(" DeviceName: " + p.getDeviceName());
+                       DumpEnd();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               ident++;
+               try
+               {
+                       DumpBegin();
+                       Dump("TotalFreeSpace: " + p.getTotalFreeSpace());
+                       Dump(" TotalQuota: " + p.getTotalQuota());
+                       Dump(" TotalTotalSpace: " + p.getTotalSpace());
+                       DumpEnd();
+
+                       //test some queries, don't write to output
+                       p.getInfo();
+                       p.getInfoVolumes();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               ident--;
+       }
+
+       public static void DumpGroup(Group g)
+       {
+               try
+               {
+                       DumpBegin();
+                       Dump("Group name: " + g.getName());
+                       Dump(" Type: " + g.getType());
+                       Dump(" UID: " + g.getUID());
+                       DumpEnd();
+                       
+                       //test some queries, don't write to output
+                       g.getInfo();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void DumpUser(User u)
+       {
+               DumpLn("User name: " + u.getName());
+               ident++;
+               try
+               {
+
+                       DumpLn("EncryptionKey" + u.getEncryptionKey());
+                       DumpBegin();
+                       Dump("DaysToPasswordExpire: " + u.getDaysToPasswordExpire());
+                       Dump(" FailLoginCount: " + u.getFailLoginCount());
+                       Dump(" KeyCheckSum: " + u.getKeyCheckSum());
+                       DumpEnd();
+                       DumpBegin();
+                       Dump("UserExpirationDate: " + getGregDateStr(u.getUserExpirationDate()));
+                       Dump(" MaxTicketLifetime: " + u.getMaxTicketLifetime());
+                       Dump(" LockedUntilDate: " + getGregDateStr(u.getLockedUntilDate()));
+                       DumpEnd();
+
+                       
+                       //test some queries, don't write to output
+                       u.getInfo();
+                       u.getInfoGroups();
+                       u.getInfoGroupsOwned();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               ident--;
+       }
+
+       static void DumpProcess(org.openafs.jafs.Process p)
+       {
+               DumpLn("Process name: " + p.getName());
+               ident++;
+               try
+               {
+
+                       DumpBegin();
+                       Dump("StartTimeDate: " + getGregDateStr(p.getStartTimeDate()));
+                       Dump(" ExitTimeDate: " + getGregDateStr(p.getExitTimeDate()));
+                       DumpEnd();
+                       
+                       //test some queries, don't write to output
+                       p.getInfo();
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               ident--;
+       }
+
+       public static Token testToken(String user, String pass, String cell)
+       {
+               Token token = null;
+               try
+               {
+                       token = new Token(user, pass, cell);
+                       DumpToken(token);
+                       testCell(token);
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               return token;
+       }
+
+       public static void testFilesRecursive(File dir)
+       {
+               try
+               {
+                       java.io.File fj = new java.io.File(dir.getPath());
+                       String[] strSubdirs = fj.list();
+                       for(int i=0; i<strSubdirs.length; i++)
+                       {
+                               org.openafs.jafs.File f = new org.openafs.jafs.File(
+                                               dir.getPath() + "/" + strSubdirs[i]);
+                               DumpFile(f);
+                               f.validate();
+                               if (f.isDirectory() || f.isMountPoint() || f.isLink())
+                               {
+                                       testFilesRecursive(dir);
+                               }
+                       }
+               } catch(AFSFileException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void testFiles()
+       throws AFSException, AFSFileException
+       {
+               org.openafs.jafs.File f = new org.openafs.jafs.File(firstCellPathRW);
+               DumpFile(f);
+               testFilesRecursive(f);
+       }
+       
+       public static void testCell(Token token)
+       {
+               Cell cell = null;
+               try
+               {
+                       cell = new Cell(token, false);
+
+                       DumpCell(cell);
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               if (cell==null)
+                       return;
+
+               ident++;
+               try
+               {
+                       Group[] groups = cell.getGroups();
+                       for(int i=0; i<groups.length; i++)
+                       {
+                               testGroup(groups[i]);
+                       }
+       
+                       Server[] servers = cell.getServers();
+                       for(int j=0; j<servers.length; j++)
+                       {
+                               testServer(servers[j]);
+                       }
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               ident--;
+
+               try
+               {
+                       if (cell!=null)
+                               cell.close();
+                } catch(AFSException e) {
+                        e.printStackTrace();
+                }
+       }
+       
+       public static void testServer(Server server)
+       throws AFSException
+       {
+               DumpServer(server);
+               ident++;
+               try
+               {
+                       Partition[] parts = server.getPartitions();
+                       if (parts!=null)
+                       {
+                               for(int i=0; i<parts.length; i++)
+                               {
+                                       testPartition(parts[i]);
+                               }
+                       }
+       
+                       org.openafs.jafs.Process[] procs = server.getProcesses();
+                       if (procs!=null)
+                       {
+                               for(int i=0; i<procs.length; i++)
+                               {
+                                       DumpProcess(procs[i]);
+                               }
+                       }
+
+                       DumpLn("salvage...");
+                       server.salvage();
+                       DumpLn("getLog...");
+                       try
+                       {
+                               server.getLog("/var/log/openafs/BosLog");
+                       } catch(AFSException e) {
+                               e.printStackTrace();
+                       }
+                       //DumpLn("stopAllProcesses...");
+                       //server.stopAllProcesses();
+                       //DumpLn("startAllProcesses...");
+                       //server.startAllProcesses();
+                       DumpLn("syncServer...");
+                       server.syncServer();
+                       DumpLn("syncVLDB...");
+                       server.syncVLDB();
+                       DumpLn("ok.");
+               } catch(AFSException e) {
+                       e.printStackTrace();
+               }
+               ident--;
+       }
+
+       public static void testProcess(org.openafs.jafs.Process p)
+       throws AFSException
+       {
+               DumpProcess(p);
+       }
+
+       public static void testPartition(Partition part)
+       throws AFSException
+       {
+               DumpPartition(part);
+               ident++;
+
+               Volume[] vols = part.getVolumes();
+               for(int i=0; i<vols.length; i++)
+               {
+                       testVolume(vols[i]);
+               }
+
+               ident--;
+       }
+       
+       public static void testVolume(Volume vol)
+       throws AFSException
+       {
+               DumpVolume(vol);
+       }
+       
+       public static void testGroup(Group group)
+       throws AFSException
+       {
+               DumpGroup(group);
+               ident++;
+
+               User[] users = group.getMembers();
+               for(int i=0; i<users.length; i++)
+               {
+                       testUser(users[i]);
+               }
+
+               ident--;
+       }
+       
+       public static void testUser(User user)
+       throws AFSException
+       {
+               DumpUser(user);
+       }
+
+       public static void testNewVolume(String cellName, String userName, String passString)
+       {
+               if (firstCellPathRW==null)
+               {
+                       System.err.println("testNewVolume cannot be executed (null args).");
+                       return;
+               }
+
+               String volName = "myTestJafsVolume92834";
+               String mpName = firstCellPathRW + "/" + volName;
+               try
+               {
+                       Token token = new Token(cellName, userName, passString);
+                       Cell cell = new Cell(token, false);
+                       Server[] servers = cell.getServers();
+                       if (servers.length==0)
+                       {
+                               System.err.println("Error: failed to run\"testNewVolume\"!");
+                               return;
+                       }
+                       Partition firstPart = null;
+                       int i;
+                       for(i=0; i<servers.length; i++)
+                       {
+                               Partition[] parts = servers[i].getPartitions();
+                               if (parts==null)
+                                       continue;
+
+                               if (parts.length!=0)
+                               {
+                                       firstPart = parts[0];
+                                       break;
+                               }
+                       }
+                       if (firstPart==null)
+                       {
+                               System.err.println("Error: failed to find any partition on any server - \"testNewVolume\" couldn't be tested!");
+                               return;
+                       }
+
+                       Volume v = new Volume(volName, firstPart);
+                       DumpLn("Creating a new volume " + volName + " ...");
+                       v.create(0);
+
+                       v.lock();
+                       v.unlock();
+
+                       volName = "myTestJafsVolume2389";
+                       DumpLn("Renaming volume to " + volName + " ...");
+                       v.rename(volName);
+
+                       DumpLn("Creating an rw mount point " + mpName + " ...");
+                       v.createMountPoint(mpName, true);
+
+                       DumpLn("Deleting mount point...");
+                       java.lang.Runtime.getRuntime().exec("fs rmmount " + mpName);
+                       
+                       DumpLn("Creating RO...");
+                       Volume volRO = v.createReadOnly(firstPart);
+
+                       DumpLn("Creating backup...");
+                       v.createBackup();
+
+                       DumpLn("Releaseing volume...");
+                       v.release();
+
+                       //v.moveTo();   //needs a more careful test env
+
+                       DumpLn("Salvaging volume...");
+                       v.salvage();
+
+                       DumpLn("Deleting volume...");
+                       v.delete();
+
+                       DumpLn("Deleting RO site...");
+                       volRO.delete();
+
+                       DumpLn("OK.");
+               } catch(Exception e) {
+                       e.printStackTrace();
+               }
+       }
+       
+       public static void main(String[] args)
+       {
+
+               try
+               {
+                       if (args.length<4)
+                       {
+                               System.err.println("testAFS <user> <pass> <cell_name> <# of cycles>");
+                               return;
+                       }
+
+                       Class.forName("org.openafs.jafs.Token");        //initialization...
+                       System.out.println("Java interface version: " + VersionInfo.getVersionOfJavaInterface());
+                       System.out.println("Library version: " + VersionInfo.getVersionOfLibrary());
+                       System.out.println("Build info: " + VersionInfo.getBuildInfo());
+
+                       //first test whether token is valid
+                       //and load libraries with it
+                       Token t0 = new Token(args[0], args[1], args[2]);
+                       t0.close();
+
+                       System.out.print("Starting another tester thread...");
+                       testAFS ta = new testAFS();
+                       TesterThread tt = ta.new TesterThread(args[0], args[1], args[2]);
+                       Thread tTest = new Thread(tt);
+                       tTest.start();
+                       System.out.println("started.");
+
+                       firstCellPathRW = "/afs/." + args[2];
+                       int numOfCycles = Integer.parseInt(args[3]);
+                       for(int i=0; i<numOfCycles || numOfCycles==0; i++)
+                       {
+                               testToken(args[0], args[1], args[2]);
+
+                               testFiles();
+
+                               testNewVolume(args[0], args[1], args[2]);
+
+                               System.out.print("ACL excercising...");
+                               allowDump = false;
+                               for(int j=0; j<100; j++)
+                               {
+                                       testFiles();
+                                       System.out.print(".");
+                               }
+                               System.out.println();
+                               allowDump = true;
+
+                               AFSException afs = new AFSException(1);
+
+                               System.out.println("cycle #" + (i+1) + "/" + numOfCycles + " done.");
+                       }
+
+                       tt.finish();
+                       System.out.println("All done.");
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
+}
index 64b245f..da9d603 100644 (file)
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <afs/vice.h>
+#include <netinet/in.h>
 #include <afs/venus.h>
 #include <afs/afs_args.h>
 
+#include "GetNativeString.h"
+
 /*
   #include <afs/afs_osi.h>
 */
 
 /* just for debugging */
-#define MAXHOSTS  13
-#define OMAXHOSTS 8
-#define MAXNAME   100
-#define MAXSIZE        2048
-#define MAXINSIZE 1300         /* pioctl complains if data is larger than this */
-#define VMSGSIZE  128          /* size of msg buf in volume hdr */
+#define        MAXHOSTS 13
+#define        OMAXHOSTS 8
+#define MAXNAME 100
+#define        MAXSIZE 2048
+#define MAXINSIZE 1300    /* pioctl complains if data is larger than this */
+#define VMSGSIZE 128      /* size of msg buf in volume hdr */
 
 static char space[MAXSIZE];
 
@@ -59,32 +62,33 @@ extern int errno;
  * path     the directory path
  * returns NULL if an exception is encountered.
  */
-char *
-getACL(char *path)
+char* getACL(char *path)
 {
     struct ViceIoctl params;
     char *buffer;
+    int rval1=0;
 
+    buffer = (char*) malloc(ACL_LEN);
     params.in = NULL;
     params.out = NULL;
-    params.in_size = 0;
-    params.out_size = 0;
-
-    buffer = (char *)malloc(ACL_LEN);
-
+    params.in_size = params.out_size = 0;
+    
     if (!buffer) {
-       fprintf(stderr, "ERROR: ACL::getACL -> could not allocate buffer\n");
-       return NULL;
+      fprintf(stderr, "ERROR: ACL::getACL -> could not allocate buffer\n");
+      return NULL;
     }
 
     params.out = buffer;
-    params.out_size = ACL_LEN;
-
-    if (call_syscall(AFSCALL_PIOCTL, path, VIOCGETAL, &params, 1, 0)) {
-       fprintf(stderr, "ERROR: ACL::getACL -> VIOCGETAL failed: %d\n",
-               errno);
-       free(buffer);
-       return NULL;
+    params.out_size = ACL_LEN; 
+
+#if defined(AFS_PPC64_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+    if(pioctl(path, VIOCGETAL, &params, 1)) {
+#else /* AFS_PPC_LINUX20_ENV */
+    if(syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, VIOCGETAL, &params, 1)) {
+#endif /* AFS_PPC_LINUX20_ENV */
+      fprintf(stderr, "ERROR: ACL::getACL -> VIOCGETAL failed: %d, path: %s\n", errno, path);
+      free(buffer);
+      return NULL;
     }
 
     return params.out;
@@ -98,8 +102,7 @@ getACL(char *path)
  * aclString  string representation of ACL to be set
  * returns TRUE if the operation succeeds; otherwise FALSE;
  */
-jboolean
-setACL(char *path, char *aclString)
+jboolean setACL(char *path, char *aclString)
 {
     struct ViceIoctl params;
     char *redirect, *parentURI, *cptr;
@@ -109,10 +112,13 @@ setACL(char *path, char *aclString)
     params.out = NULL;
     params.out_size = 0;
 
-    if (call_syscall(AFSCALL_PIOCTL, path, VIOCGETAL, &params, 1)) {
-       fprintf(stderr, "ERROR: ACL::setACL -> VIOCSETAL failed: %d\n",
-               errno);
-       return JNI_FALSE;
+#if defined(AFS_PPC64_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+    if(pioctl(path, VIOCSETAL, &params, 1)) {
+#else /* AFS_PPC_LINUX20_ENV */
+    if(syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, VIOCSETAL, &params, 1)) {
+#endif /* AFS_PPC_LINUX20_ENV */
+      fprintf(stderr, "ERROR: ACL::setACL -> VIOCSETAL failed: %d, path: %s\n", errno, path);
+      return JNI_FALSE;
     }
 
     return JNI_TRUE;
@@ -128,31 +134,38 @@ setACL(char *path, char *aclString)
  * path     the directory path
  * returns NULL if an exception is encountered.
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_ACL_getACLString(JNIEnv * env, jobject obj,
-                                      jstring pathUTF)
+JNIEXPORT jstring JNICALL Java_org_openafs_jafs_ACL_getACLString
+  (JNIEnv *env, jobject obj, jstring pathUTF)
 {
     char *path, *acl;
     jstring answer = NULL;
 
-    path = getNativeString(env, pathUTF);
-    if (path == NULL) {
-       fprintf(stderr, "ERROR: ACL::getACLString ->");
-       fprintf(stderr, "path = NULL\n");
-       throwAFSException(env, JAFSNULLPATH);
-       return NULL;
+    /*jchar* wpath;
+    path = (char*) (*env)->GetStringUTFChars(env, pathUTF, 0);
+    wpath=(jchar*) (*env)->GetStringChars(env,pathUTF,0);*/
+
+    path = GetNativeString(env,pathUTF);
+
+    if(path == NULL) {
+      fprintf(stderr, "ERROR: ACL::getACLString ->");
+      fprintf(stderr, "path = NULL\n");
+      throwMessageException( env, "Path is NULL" ); 
+      return NULL;
     }
 
     acl = getACL(path);
-    free(path);
 
-    if (acl) {
-       answer = (*env)->NewStringUTF(env, acl);
-       free(acl);
+    if(acl) {
+      answer =  (*env) -> NewStringUTF(env, acl);
+      free(acl);
     } else {
-       throwAFSException(env, errno);
+      throwAFSException( env, errno );
     }
 
+    /*(*env)->ReleaseStringUTFChars(env, pathUTF, path);
+      (*env)->ReleaseStringChars(env, pathUTF, (jchar*)wpath);*/
+
+    free(path); //psomogyi memory leak - added
     return answer;
 }
 
@@ -168,52 +181,52 @@ Java_org_openafs_jafs_ACL_getACLString(JNIEnv * env, jobject obj,
  * aclString  string representation of ACL to be set
  * throws an afsAdminExceptionName if an internal exception is encountered.
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_ACL_setACLString(JNIEnv * env, jobject obj,
-                                      jstring pathUTF, jstring aclStringUTF)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_ACL_setACLString
+  (JNIEnv *env, jobject obj, jstring pathUTF, jstring aclStringUTF)
 {
     char *path, *aclString;
 
-    if (pathUTF == NULL) {
-       fprintf(stderr, "ERROR: ACL::setACLString -> pathUTF == NULL\n");
-       throwAFSException(env, JAFSNULLPATH);
-       return;
+    if(!pathUTF) {
+      fprintf(stderr, "ERROR: ACL::setACLString -> pathUTF == NULL\n");
+      throwMessageException( env, "pathUTF == NULL" );
+      return;
     }
 
-    if (aclStringUTF == NULL) {
-       fprintf(stderr, "ERROR: ACL::setACLString -> aclStringUTF == NULL\n");
-       throwAFSException(env, JAFSNULLACL);
-       return;
+    /*path = (char*) (*env)->GetStringUTFChars(env, pathUTF, 0);*/
+    path = GetNativeString(env,pathUTF);
+
+    if(path == NULL) {
+      fprintf(stderr, "ERROR: ACL::setACLString -> failed to get path\n");
+      throwMessageException( env, "Failed to get path" );
+      return;
     }
 
-    /* path = (char*) (*env)->GetStringUTFChars(env, pathUTF, 0); */
-    path = getNativeString(env, pathUTF);
-    if (path == NULL) {
-       fprintf(stderr, "ERROR: ACL::setACLString -> failed to get path\n");
-       throwMessageException(env, "Failed to get path.");
-       return;
+    if(!aclStringUTF) {
+      fprintf(stderr, "ERROR: ACL::setACLString -> aclStringUTF == NULL\n");
+      throwMessageException( env, "aclStringUTF == NULL" ); 
+      return;
     }
 
-    /* aclString = (char*) (*env)->GetStringUTFChars(env, aclStringUTF, 0); */
-    aclString = getNativeString(env, aclStringUTF);
-    if (aclString == NULL) {
-       free(path);
-       fprintf(stderr,
-               "ERROR: ACL::setACLString -> failed to get aclString\n");
-       throwMessageException(env, "Failed to get ACL string.");
-       return;
+    /*aclString = (char*) (*env)->GetStringUTFChars(env, aclStringUTF, 0);*/
+    aclString = GetNativeString(env,aclStringUTF);
+
+    if(aclString == NULL) {
+      fprintf(stderr, "ERROR: ACL::setACLString -> failed to get aclString\n");
+      (*env)->ReleaseStringUTFChars(env, pathUTF, path);
+      throwMessageException( env, "aclString == NULL" ); 
+      return;
     }
 
     if (!setACL(path, aclString)) {
-       throwAFSException(env, errno);
+      throwAFSException( env, errno );
     }
 
-    /* Clean up */
+    /*(*env)->ReleaseStringUTFChars(env, pathUTF, path);
+      (*env)->ReleaseStringUTFChars(env, aclStringUTF, aclString);*/
+
     free(path);
     free(aclString);
-
-    /*
-     * (*env)->ReleaseStringUTFChars(env, pathUTF, path);
-     * (*env)->ReleaseStringUTFChars(env, aclStringUTF, aclString);
-     */
 }
+
+
+
index af543a3..80c85dc 100644 (file)
  * env      the Java environment
  * obj      the current Java object
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_initializeAdminClient(JNIEnv * env, jclass cls)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Token_initializeAdminClient(JNIEnv *env, jclass cls)
 {
-    afs_status_t ast;
-    if (!afsclient_Init(&ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  if( !afsclient_Init( &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 }
 
 
@@ -60,73 +60,75 @@ Java_org_openafs_jafs_Token_initializeAdminClient(JNIEnv * env, jclass cls)
  * jpassword    the password of the user
  * returns a token representing the authentication
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Token_getToken(JNIEnv * env, jobject obj,
-                                    jstring jcellName, jstring juserName,
-                                    jstring jpassword)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Token_getToken
+  (JNIEnv *env, jobject obj, jstring jcellName, jstring juserName,
+   jstring jpassword)
 {
-    afs_status_t ast;
-    char *cellName;
-    char *userName;
-    char *password;
-    void *tokenHandle;
-    int rc;
-
-    // convert java strings
-    if (jcellName != NULL) {
-       cellName = getNativeString(env, jcellName);
-       if (!cellName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return 0;
-       }
-    } else {
-       cellName = NULL;
-    }
-
-    if (juserName != NULL) {
-       userName = getNativeString(env, juserName);
-       if (!userName) {
-           if (cellName != NULL)
-               free(cellName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return 0;
-       }
-    } else {
-       if (cellName != NULL)
-           free(cellName);
-       throwAFSException(env, JAFSNULLUSER);
-       return 0;
-    }
-
-    if (jpassword != NULL) {
-       password = getNativeString(env, jpassword);
-       if (!password) {
-           if (cellName != NULL)
-               free(cellName);
-           free(userName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return 0;
-       }
-    } else {
-       if (cellName != NULL)
-           free(cellName);
-       free(userName);
-       throwAFSException(env, JAFSNULLPASS);
-       return 0;
-    }
-
-    if (!
-       (afsclient_TokenGetNew
-        (cellName, userName, password, &tokenHandle, &ast))) {
-       throwAFSException(env, ast);
-    }
-
-    if (cellName != NULL)
-       free(cellName);
-    free(userName);
-    free(password);
-
-    return (jint) tokenHandle;
+  afs_status_t ast;
+  const char *cellName;
+  const char *userName;
+  const char *password;
+  void *tokenHandle;
+  int rc;
+
+  // convert java strings
+  if( jcellName != NULL ) { 
+      cellName = (*env)->GetStringUTFChars(env, jcellName, 0);
+      if( !cellName ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return 0;    
+      }
+  } else {
+      cellName = NULL;
+  }
+  if( juserName != NULL ) {
+      userName = (*env)->GetStringUTFChars(env, juserName, 0);
+      if( !userName ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return 0;    
+      }
+  } else {
+      userName = NULL;
+  }
+  if( jpassword != NULL ) {
+      password = (*env)->GetStringUTFChars(env, jpassword, 0);
+      if( !password ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return 0;    
+      }
+  } else {
+      password = NULL;
+  }
+
+  if ( !(afsclient_TokenGetNew( cellName, userName, password, &tokenHandle, 
+                               &ast) ) ) {
+    // release converted strings
+      if( cellName != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jcellName, cellName);
+      }
+      if( userName != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, juserName, userName);
+      }
+      if( password != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jpassword, password);
+      }
+      throwAFSException( env, ast );
+      return 0;
+  }
+
+  // release converted strings
+  if( cellName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jcellName, cellName);
+  }
+  if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
+  if( password != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jpassword, password);
+  }
+
+  return (jlong) tokenHandle;
 }
 
 /**
@@ -136,14 +138,15 @@ Java_org_openafs_jafs_Token_getToken(JNIEnv * env, jobject obj,
  * obj      the current Java object
  * tokenHandle   the token to close
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_close(JNIEnv * env, jobject obj, jint tokenHandle)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Token_close
+  (JNIEnv *env, jobject obj, jlong tokenHandle)
 {
     afs_status_t ast;
 
-    if (!afsclient_TokenClose((void *)tokenHandle, &ast)) {
-       throwAFSException(env, ast);
-       return;
+    if( !afsclient_TokenClose( (void *) tokenHandle, &ast ) ) {
+      throwAFSException( env, ast );
+      return;
     }
 }
 
@@ -158,32 +161,38 @@ Java_org_openafs_jafs_Token_close(JNIEnv * env, jobject obj, jint tokenHandle)
  * tokenHandle    a token handle previously returned by a call to getToken
  * returns a handle to the open cell
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getCellHandle(JNIEnv * env, jobject obj,
-                                        jstring jcellName, jint tokenHandle)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Cell_getCellHandle
+  (JNIEnv *env, jobject obj, jstring jcellName, jlong tokenHandle)
 {
-    afs_status_t ast;
-    char *cellName;
-    void *cellHandle;
-
-    if (jcellName != NULL) {
-       cellName = getNativeString(env, jcellName);
-       if (!cellName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return -1;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLCELL);
-       return -1;
+  afs_status_t ast;
+  const char *cellName;
+  void *cellHandle;
+
+  if( jcellName != NULL ) {
+    cellName = (*env)->GetStringUTFChars(env, jcellName, 0);
+    if( !cellName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
-
-    if (!afsclient_CellOpen(cellName, (void *)tokenHandle, &cellHandle, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(cellName);
-
-    return (jint) cellHandle;
+  } else {
+    cellName = NULL;
+  }
+
+  if( !afsclient_CellOpen( cellName, (void *) tokenHandle, 
+                          &cellHandle, &ast ) ) {
+    if( cellName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jcellName, cellName);
+    }  
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( cellName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jcellName, cellName);
+  }  
+
+  return (jlong) cellHandle;
 }
 
 /**
@@ -193,16 +202,18 @@ Java_org_openafs_jafs_Cell_getCellHandle(JNIEnv * env, jobject obj,
  * obj      the current Java object
  * cellHandle   the cell handle to close
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_closeCell(JNIEnv * env, jobject obj,
-                                    jint cellHandle)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_closeCell (JNIEnv *env, jobject obj, 
+                                         jlong cellHandle)
 {
-    afs_status_t ast;
 
-    if (!afsclient_CellClose((void *)cellHandle, &ast)) {
-       throwAFSException(env, ast);
-       return;
+   afs_status_t ast;
+
+    if( !afsclient_CellClose( (void *) cellHandle, &ast ) ) {
+      throwAFSException( env, ast );
+      return;
     }
+
 }
 
 /**
@@ -218,34 +229,40 @@ Java_org_openafs_jafs_Cell_closeCell(JNIEnv * env, jobject obj,
  *                      a vos handle
  * returns a vos handle to the server
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getVosServerHandle(JNIEnv * env, jobject obj,
-                                               jint cellHandle,
-                                               jstring jserverName)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Server_getVosServerHandle
+  (JNIEnv *env, jobject obj, jlong cellHandle, jstring jserverName)
 {
-    afs_status_t ast;
-    void *serverHandle;
-    char *serverName;
-
-    if (jserverName != NULL) {
-       serverName = getNativeString(env, jserverName);
-       if (!serverName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return -1;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLSERVER);
-       return -1;
-    }
-
-    if (!vos_ServerOpen
-       ((void *)cellHandle, serverName, (void **)&serverHandle, &ast)) {
-       throwAFSException(env, ast);
-    }
-    // release converted string
-    free(serverName);
-
-    return (jint) serverHandle;
+  afs_status_t ast;
+  void *serverHandle;
+  // convert java string
+  const char *serverName;
+
+  if( jserverName != NULL ) {
+      serverName = (*env)->GetStringUTFChars(env, jserverName, 0);
+      if( !serverName ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
+  } else {
+      serverName = NULL;
+  }
+
+  if( !vos_ServerOpen( (void *) cellHandle, serverName, 
+                      (void **) &serverHandle, &ast ) ) {
+      if( serverName != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jserverName, serverName);
+      }
+      throwAFSException( env, ast );
+      return 0;
+  }
+
+  // release converted string
+  if( serverName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jserverName, serverName);
+  }
+
+  return (jlong) serverHandle;
 }
 
 /**
@@ -255,15 +272,15 @@ Java_org_openafs_jafs_Server_getVosServerHandle(JNIEnv * env, jobject obj,
  * obj      the current Java object
  * vosServerHandle   the vos server handle to close
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_closeVosServerHandle(JNIEnv * env, jobject obj,
-                                                 jint vosServerHandle)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_closeVosServerHandle
+  (JNIEnv *env, jobject obj, jlong vosServerHandle)
 {
     afs_status_t ast;
 
-    if (!vos_ServerClose((void *)vosServerHandle, &ast)) {
-       throwAFSException(env, ast);
-       return;
+    if( !vos_ServerClose( (void *) vosServerHandle, &ast ) ) {
+      throwAFSException( env, ast );
+      return;
     }
 }
 
@@ -280,34 +297,40 @@ Java_org_openafs_jafs_Server_closeVosServerHandle(JNIEnv * env, jobject obj,
  *                      a bos handle
  * returns a bos handle to the server
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getBosServerHandle(JNIEnv * env, jobject obj,
-                                               jint cellHandle,
-                                               jstring jserverName)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Server_getBosServerHandle
+  (JNIEnv *env, jobject obj, jlong cellHandle, jstring jserverName)
 {
-    afs_status_t ast;
-    void *serverHandle;
-    char *serverName;
-
-    if (jserverName != NULL) {
-       serverName = getNativeString(env, jserverName);
-       if (!serverName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLSERVER);
-       return;
-    }
-
-    if (!bos_ServerOpen
-       ((void *)cellHandle, serverName, (void **)&serverHandle, &ast)) {
-       throwAFSException(env, ast);
-    }
-    // release converted string
-    free(serverName);
-
-    return (jint) serverHandle;
+  afs_status_t ast;
+  void *serverHandle;
+  // convert java string
+  const char *serverName;
+
+  if( jserverName != NULL ) {
+      serverName = (*env)->GetStringUTFChars(env, jserverName, 0);
+      if( !serverName ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
+  } else {
+      serverName = NULL;
+  }
+
+  if( !bos_ServerOpen( (void *) cellHandle, serverName, 
+                      (void **) &serverHandle, &ast ) ) {
+      if( serverName != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jserverName, serverName);
+      }
+      throwAFSException( env, ast );
+      return 0;
+  }
+
+  // release converted string
+  if( serverName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jserverName, serverName);
+  }
+
+  return (jlong) serverHandle;
 }
 
 /**
@@ -317,15 +340,15 @@ Java_org_openafs_jafs_Server_getBosServerHandle(JNIEnv * env, jobject obj,
  * obj      the current Java object
  * bosServerHandle   the bos server handle to close
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_closeBosServerHandle(JNIEnv * env, jobject obj,
-                                                 jint bosServerHandle)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_closeBosServerHandle
+  (JNIEnv *env, jobject obj, jlong bosServerHandle)
 {
     afs_status_t ast;
 
-    if (!bos_ServerClose((void *)bosServerHandle, &ast)) {
-       throwAFSException(env, ast);
-       return;
+    if( !bos_ServerClose( (void *) bosServerHandle, &ast ) ) {
+      throwAFSException( env, ast );
+      return;
     }
 }
 
@@ -339,45 +362,55 @@ Java_org_openafs_jafs_Server_closeBosServerHandle(JNIEnv * env, jobject obj,
  *                       to getToken
  * returns a long representing the UTC time for the token expiration
  */
-JNIEXPORT jlong JNICALL
-Java_org_openafs_jafs_Token_getExpiration(JNIEnv * env, jobject obj,
-                                         jint tokenHandle)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Token_getExpiration
+  (JNIEnv *env, jobject obj, jlong tokenHandle)
 {
     afs_status_t ast;
     unsigned long expTime;
-    char *prince = malloc(sizeof(char) * KAS_MAX_NAME_LEN);
-    char *inst = malloc(sizeof(char) * KAS_MAX_NAME_LEN);
-    char *cell = malloc(sizeof(char) * AFS_MAX_SERVER_NAME_LEN);
+    char *prince = malloc( sizeof(char)*KAS_MAX_NAME_LEN ); 
+    char *inst = malloc( sizeof(char)*KAS_MAX_NAME_LEN );    
+    char *cell = malloc( sizeof(char)*AFS_MAX_SERVER_NAME_LEN );    
     int hkt;
 
-    if (!prince || !inst || !cell) {
-       if (prince) {
-           free(prince);
-       }
-       if (inst) {
-           free(inst);
-       }
-       if (cell) {
-           free(cell);
-       }
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
+    if( !prince || !inst || !cell ) {
+      if( prince ) {
+        free( prince );
+      }
+      if( inst ) {
+        free( inst );
+      }
+      if( cell ) {
+        free( cell );
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
     }
 
-    if (!afsclient_TokenQuery
-       ((void *)tokenHandle, &expTime, prince, inst, cell, &hkt, &ast)) {
-       throwAFSException(env, ast);
+    if( !afsclient_TokenQuery( (void *) tokenHandle, &expTime, prince, inst, 
+                              cell, &hkt, &ast ) ) {
+       free( prince );
+       free( inst );
+       free( cell );
+       throwAFSException( env, ast );
+       return 0;
     }
 
-    free(prince);
-    free(inst);
-    free(cell);
+    free( prince );
+    free( inst );
+    free( cell );
 
     return (jlong) expTime;
 }
 
 // reclaim global memory used by this portion
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_reclaimAuthMemory(JNIEnv * env, jclass cls)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Token_reclaimAuthMemory (JNIEnv *env, jclass cls)
 {
 }
+
+
+
+
+
+
index f4c8e56..8ef7990 100644 (file)
@@ -33,9 +33,8 @@
 #include <afs_AdminClientErrors.h>
 #include <afs_AdminCommonErrors.h>
 
-/*-----------------------------------------------------------------------
- * Definitions in Internal.c
- */
+//// definitions in Internal.c  //////////////////
+
 extern jclass userCls;
 //extern jfieldID user_cellHandleField;
 extern jfieldID user_nameField;
@@ -50,26 +49,28 @@ extern jclass serverCls;
 //extern jfieldID server_cellHandleField;
 extern jfieldID server_cachedInfoField;
 
-/*-----------------------------------------------------------------------
- * Definition in User.c
- */
-extern void getUserInfoChar(JNIEnv * env, int cellHandle, const char *name,
-                           jobject user);
+//////////////////////////////////////////////////////////
 
-/*-----------------------------------------------------------------------
- * Definition in Group.c
- */
-extern void getGroupInfoChar(JNIEnv * env, int cellHandle, const char *name,
-                            jobject group);
+///// definition in jafs_User.c /////////////////
 
-/*-----------------------------------------------------------------------
- * Definition in Server.c
- */
-extern void fillServerInfo(JNIEnv * env, jint cellHandle, jobject server,
-                          afs_serverEntry_t servEntry);
+extern void getUserInfoChar (JNIEnv *env, void *cellHandle, const char *name, 
+                            jobject user);
+
+///////////////////////////////////////////////////
+
+///// definition in jafs_Group.c /////////////////
+
+extern void getGroupInfoChar (JNIEnv *env, void *cellHandle, const char *name, 
+                             jobject group);
+
+///////////////////////////////////////////////////
+
+///// definition in jafs_Server.c /////////////////
 
+extern void fillServerInfo (JNIEnv *env, void *cellHandle, jobject server, 
+                           afs_serverEntry_t servEntry);
 
-/*-----------------------------------------------------------------------*/
+///////////////////////////////////////////////////
 
 /**
  * Returns the total number of KAS users belonging to the cell denoted
@@ -80,29 +81,29 @@ extern void fillServerInfo(JNIEnv * env, jint cellHandle, jobject server,
  *  cellHandle    the handle of the cell to which the users belong
  *  returns total count of KAS users
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getKasUserCount(JNIEnv * env, jclass cls,
-                                          jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    kas_identity_t who;
-    int i = 0;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getKasUserCount (JNIEnv *env, jclass cls, 
+                                              jlong cellHandle) {
 
-    if (!kas_PrincipalGetBegin((void *)cellHandle, NULL, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  afs_status_t ast;
+  void *iterationId;
+  kas_identity_t who;
+  int i = 0;
 
-    while (kas_PrincipalGetNext((void *)iterationId, &who, &ast))
-       i++;
+  if( !kas_PrincipalGetBegin( (void *) cellHandle, NULL, 
+                             &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  while ( kas_PrincipalGetNext( iterationId, &who, &ast ) ) i++;
+
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 
@@ -117,19 +118,21 @@ Java_org_openafs_jafs_Cell_getKasUserCount(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the users belong
  *  returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getKasUsersBegin(JNIEnv * env, jclass cls,
-                                           jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Cell_getKasUsersBegin (JNIEnv *env, jclass cls, 
+                                               jlong cellHandle) {
 
-    if (!kas_PrincipalGetBegin((void *)cellHandle, NULL, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  void *iterationId;
+
+  if( !kas_PrincipalGetBegin( (void *) cellHandle, NULL, &iterationId, 
+                             &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -145,33 +148,35 @@ Java_org_openafs_jafs_Cell_getKasUsersBegin(JNIEnv * env, jclass cls,
  *  startIndex    the starting base-zero index
  *  returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getKasUsersBeginAt(JNIEnv * env, jclass cls,
-                                             jint cellHandle,
-                                             jint startIndex)
-{
-    afs_status_t ast;
-    void *iterationId;
-    kas_identity_t who;
-    int i;
-
-    if (!kas_PrincipalGetBegin((void *)cellHandle, NULL, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
-
-    for (i = 1; i < startIndex; i++) {
-       if (!kas_PrincipalGetNext((void *)iterationId, &who, &ast)) {
-           if (ast == ADMITERATORDONE) {
-               return 0;
-           } else {
-               throwAFSException(env, ast);
-               return 0;
-           }
-       }
-    }
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Cell_getKasUsersBeginAt (JNIEnv *env, jclass cls, 
+                                                 jlong cellHandle, 
+                                                 jint startIndex) {
+
+  afs_status_t ast;
+  void *iterationId;
+  kas_identity_t who;
+  int i;
+
+  if( !kas_PrincipalGetBegin( (void *) cellHandle, NULL, 
+                             &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  for ( i = 1; i < startIndex; i++) {
+    if( !kas_PrincipalGetNext( (void *) iterationId, &who, &ast ) ) {
+      if( ast == ADMITERATORDONE ) {
+        return 0;
+      } else {
+        throwAFSException( env, ast );
+        return 0;
+      }
+    }
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -184,43 +189,43 @@ Java_org_openafs_jafs_Cell_getKasUsersBeginAt(JNIEnv * env, jclass cls,
  *  iterationId   the iteration ID of this iteration
  *  returns the name of the next user of the cell
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Cell_getKasUsersNextString(JNIEnv * env, jclass cls,
-                                                jint iterationId)
-{
-    afs_status_t ast;
-    kas_identity_t who;
-    jstring juser;
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Cell_getKasUsersNextString (JNIEnv *env, jclass cls, 
+                                                    jlong iterationId) {
 
-    if (!kas_PrincipalGetNext((void *)iterationId, &who, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-           // other
-       } else {
-           throwAFSException(env, ast);
-           return;
-       }
-    }
+  afs_status_t ast;
+  kas_identity_t who;
+  jstring juser;
 
-    if (strcmp(who.instance, "")) {
-       char *fullName = (char *)malloc(sizeof(char) * (strlen(who.principal)
-                                                       + strlen(who.instance)
-                                                       + 2));
-       if (!fullName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-       *fullName = '\0';
-       strcat(fullName, who.principal);
-       strcat(fullName, ".");
-       strcat(fullName, who.instance);
-       juser = (*env)->NewStringUTF(env, fullName);
-       free(fullName);
+  if( !kas_PrincipalGetNext( (void *) iterationId, &who, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+       return NULL;
+    // other
     } else {
-       juser = (*env)->NewStringUTF(env, who.principal);
-    }
-
-    return juser;
+      throwAFSException( env, ast );
+      return;
+    }    
+  }
+
+  if( strcmp( who.instance, "" ) ) {
+    char *fullName = (char *) malloc( sizeof(char)*( strlen( who.principal ) 
+                                                    + strlen( who.instance ) 
+                                                    + 2 ) );
+    if( !fullName ) {
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+    *fullName = '\0';
+    strcat( fullName, who.principal );
+    strcat( fullName, "." );
+    strcat( fullName, who.instance );
+    juser = (*env)->NewStringUTF(env, fullName );
+    free( fullName );
+  } else {
+    juser = (*env)->NewStringUTF(env, who.principal);
+  }
+
+  return juser;
 
 }
 
@@ -236,61 +241,60 @@ Java_org_openafs_jafs_Cell_getKasUsersNextString(JNIEnv * env, jclass cls,
  *                  the next kas user
  *  returns 0 if there are no more users, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getKasUsersNext(JNIEnv * env, jclass cls,
-                                          jint cellHandle, jint iterationId,
-                                          jobject juserObject)
-{
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getKasUsersNext (JNIEnv *env, jclass cls, 
+                                              jlong cellHandle, 
+                                              jlong iterationId, 
+                                              jobject juserObject) {
 
-    afs_status_t ast;
-    kas_identity_t who;
-    jstring juser;
-    char *fullName = NULL;
+  afs_status_t ast;
+  kas_identity_t who;
+  jstring juser;
+  char *fullName = NULL;
 
 
-    if (!kas_PrincipalGetNext((void *)iterationId, &who, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return 0;
-           // other
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
-    }
-    // take care of the instance stuff(by concatenating with a period in between)
-    if (strcmp(who.instance, "")) {
-       fullName =
-           (char *)malloc(sizeof(char) *
-                          (strlen(who.principal) + strlen(who.instance) +
-                           2));
-       if (!fullName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-       *fullName = '\0';
-       strcat(fullName, who.principal);
-       strcat(fullName, ".");
-       strcat(fullName, who.instance);
-       juser = (*env)->NewStringUTF(env, fullName);
-    } else {
-       juser = (*env)->NewStringUTF(env, who.principal);
-    }
-
-    if (userCls == 0) {
-       internal_getUserClass(env, juserObject);
-    }
-
-    (*env)->SetObjectField(env, juserObject, user_nameField, juser);
-
-    if (fullName != NULL) {
-       getUserInfoChar(env, (int)cellHandle, fullName, juserObject);
-       free(fullName);
+  if( !kas_PrincipalGetNext( (void *) iterationId, &who, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+       return 0;
+    // other
     } else {
-       getUserInfoChar(env, (int)cellHandle, who.principal, juserObject);
-    }
-    (*env)->SetBooleanField(env, juserObject, user_cachedInfoField, TRUE);
-
-    return 1;
+      throwAFSException( env, ast );
+      return 0;
+    }    
+  }
+
+  // take care of the instance stuff(by concatenating with a period in between)
+  if( strcmp( who.instance, "" ) ) {
+    fullName = (char *) malloc( sizeof(char)*( strlen( who.principal ) + 
+                                              strlen( who.instance ) + 2 ) );
+    if( !fullName ) {
+      throwAFSException( env, JAFSADMNOMEM );
+      return 0;    
+    }
+    *fullName = '\0';
+    strcat( fullName, who.principal );
+    strcat( fullName, "." );
+    strcat( fullName, who.instance );
+    juser = (*env)->NewStringUTF(env, fullName );
+  } else {
+    juser = (*env)->NewStringUTF(env, who.principal);
+  }
+
+  if( userCls == 0 ) {
+    internal_getUserClass( env, juserObject );
+  }
+
+  (*env)->SetObjectField(env, juserObject, user_nameField, juser);
+
+  if( fullName != NULL ) { 
+      getUserInfoChar( env, (void *) cellHandle, fullName, juserObject );
+      free( fullName );
+  } else {
+      getUserInfoChar( env, (void *) cellHandle, who.principal, juserObject );
+  }
+  (*env)->SetBooleanField( env, juserObject, user_cachedInfoField, TRUE );
+
+  return 1;
 
 }
 
@@ -301,16 +305,16 @@ Java_org_openafs_jafs_Cell_getKasUsersNext(JNIEnv * env, jclass cls,
  *  cls      the current Java class
  *  iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_getKasUsersDone(JNIEnv * env, jclass cls,
-                                          jint iterationId)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_getKasUsersDone (JNIEnv *env, jclass cls, 
+                                              jlong iterationId) {
 
-    if (!kas_PrincipalGetDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+
+  if( !kas_PrincipalGetDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
 }
 
@@ -322,23 +326,23 @@ Java_org_openafs_jafs_Cell_getKasUsersDone(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the user belongs
  *  returns the name of the cell
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Cell_getCellName(JNIEnv * env, jclass cls,
-                                      jint cellHandle)
-{
-    afs_status_t ast;
-    char *cellName;
-    jstring jcellName;
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Cell_getCellName (JNIEnv *env, jclass cls, 
+                                          jlong cellHandle) {
 
-    if (!afsclient_CellNameGet
-       ((void *)cellHandle, (const char **)&cellName, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  char *cellName;
+  jstring jcellName;
 
-    jcellName = (*env)->NewStringUTF(env, cellName);
+  if( !afsclient_CellNameGet( (void *) cellHandle, 
+                             (const char **) &cellName, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+  
+  jcellName = (*env)->NewStringUTF(env, cellName);
 
-    return jcellName;
+  return jcellName;
 
 }
 
@@ -351,38 +355,37 @@ Java_org_openafs_jafs_Cell_getCellName(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the users belong
  *  returns total number of PTS users
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getPtsUserCount(JNIEnv * env, jclass cls,
-                                          jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    char *userName;
-    int i = 0;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getPtsUserCount (JNIEnv *env, jclass cls, 
+                                              jlong cellHandle) {
 
-    if (!pts_UserListBegin((void *)cellHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  afs_status_t ast;
+  void *iterationId;
+  char *userName;
+  int i = 0;
 
-    userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  if( !pts_UserListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    if (!userName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return -1;
-    }
+  userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    while (pts_UserListNext((void *)iterationId, userName, &ast))
-       i++;
+  if( !userName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return -1;    
+  }
 
-    free(userName);
+  while ( pts_UserListNext( (void *) iterationId, userName, &ast ) ) i++;
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  free( userName );
+
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 /**
@@ -394,61 +397,62 @@ Java_org_openafs_jafs_Cell_getPtsUserCount(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the users belong
  *  returns total number of users that are in PTS and not KAS
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getPtsOnlyUserCount(JNIEnv * env, jclass cls,
-                                              jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-    kas_principalEntry_t kasEntry;
-    char *userName;
-    int i = 0;
-
-    if (who == NULL) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return -1;
-    }
-
-    if (!pts_UserListBegin((void *)cellHandle, &iterationId, &ast)) {
-       free(who);
-       throwAFSException(env, ast);
-       return -1;
-    }
-
-    userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-    if (!userName) {
-       free(who);
-       throwAFSException(env, JAFSADMNOMEM);
-       return -1;
-    }
-
-    while (pts_UserListNext((void *)iterationId, userName, &ast)) {
-       if (strcmp(userName, "anonymous") != 0) {
-           // make sure the name is within the allowed bounds
-           if (strlen(userName) > KAS_MAX_NAME_LEN) {
-               free(who);
-               free(userName);
-               throwAFSException(env, ADMPTSUSERNAMETOOLONG);
-               return -1;
-           }
-           // if there is a kas entry, recurse
-           internal_makeKasIdentity(userName, who);
-           if (!kas_PrincipalGet
-               ((void *)cellHandle, NULL, who, &kasEntry, &ast))
-               i++;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getPtsOnlyUserCount (JNIEnv *env, jclass cls, 
+                                                  jlong cellHandle) {
+
+  afs_status_t ast;
+  void *iterationId;
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );
+  kas_principalEntry_t kasEntry;
+  char *userName;
+  int i = 0;
+
+  if( !who ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return -1;
+  }
+
+  if( !pts_UserListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
+    free( who );
+    throwAFSException( env, ast );
+    return -1;
+  }
+
+  userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+    
+  if( !userName ) {
+    free( who );
+    throwAFSException( env, JAFSADMNOMEM );
+    return -1;
+  }
+
+  while ( pts_UserListNext( (void *) iterationId, userName, &ast ) ) {
+    if( strcmp( userName, "anonymous" ) != 0 ) {
+      // make sure the name is within the allowed bounds
+      if( strlen( userName ) > KAS_MAX_NAME_LEN ) {
+           free( who );
+           free( userName );
+           throwAFSException( env, ADMPTSUSERNAMETOOLONG );
+           return -1;
+         }
+  
+      // if there is a kas entry, recurse
+      internal_makeKasIdentity( userName, who );
+      if( !kas_PrincipalGet( (void *) cellHandle, NULL, who, 
+                            &kasEntry, &ast ) ) i++;
        }
-    }
+  }
 
-    free(userName);
-    free(who);
+  free( userName );
+  free( who );
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 /**
@@ -462,19 +466,19 @@ Java_org_openafs_jafs_Cell_getPtsOnlyUserCount(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the users belong
  *  returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getPtsUsersBegin(JNIEnv * env, jclass cls,
-                                           jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Cell_getPtsUsersBegin (JNIEnv *env, jclass cls, 
+                                               jlong cellHandle) {
 
-    if (!pts_UserListBegin((void *)cellHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  afs_status_t ast;
+  void *iterationId;
 
-    return (jint) iterationId;
+  if( !pts_UserListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
 }
 
@@ -487,40 +491,40 @@ Java_org_openafs_jafs_Cell_getPtsUsersBegin(JNIEnv * env, jclass cls,
  *  iterationId   the iteration ID of this iteration
  *  returns the name of the next user of the cell
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Cell_getPtsUsersNextString(JNIEnv * env, jclass cls,
-                                                jint iterationId)
-{
-    afs_status_t ast;
-    char *userName;
-    jstring juser;
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Cell_getPtsUsersNextString (JNIEnv *env, jclass cls, 
+                                                    jlong iterationId) {
 
-    userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  afs_status_t ast;
+  char *userName;
+  jstring juser;
 
-    if (!userName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return NULL;
-    }
+  userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    if (!pts_UserListNext((void *)iterationId, userName, &ast)) {
-       free(userName);
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return NULL;
-       }
-    }
+  if( !userName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
 
-    if (strcmp(userName, "anonymous") == 0) {
-       free(userName);
-       return Java_org_openafs_jafs_Cell_getPtsUsersNextString(env, cls,
-                                                               iterationId);
+  if( !pts_UserListNext( (void *) iterationId, userName, &ast ) ) {
+    free( userName );
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
     }
+  }
 
-    juser = (*env)->NewStringUTF(env, userName);
-    free(userName);
-    return juser;
+  if( strcmp( userName, "anonymous" ) == 0 ) {
+    free( userName );
+    return Java_org_openafs_jafs_Cell_getPtsUsersNextString( env, cls, 
+                                                               iterationId );
+  }
+
+  juser = (*env)->NewStringUTF(env, userName);
+  free( userName );
+  return juser;
 
 }
 
@@ -534,63 +538,68 @@ Java_org_openafs_jafs_Cell_getPtsUsersNextString(JNIEnv * env, jclass cls,
  *  cellHandle   the cell handle to which these users will belong
  *  returns the name of the next pts user (not kas user) of the cell
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Cell_getPtsOnlyUsersNextString(JNIEnv * env, jclass cls,
-                                                    jint iterationId,
-                                                    jint cellHandle)
-{
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Cell_getPtsOnlyUsersNextString (JNIEnv *env, 
+                                                        jclass cls, 
+                                                        jlong iterationId, 
+                                                        jlong cellHandle) {
+
+    kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );
     kas_principalEntry_t kasEntry;
     afs_status_t ast;
     char *userName;
     jstring juser;
 
-    if (!who) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return NULL;
+    if( !who ) {
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
     }
 
-    userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-
-    if (!userName) {
-       free(who);
-       throwAFSException(env, JAFSADMNOMEM);
-       return NULL;
+    userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+    
+    if( !userName ) {
+      free( who );
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
     }
 
-    while (1) {
+    while( 1 ) {
 
-       if (!pts_UserListNext((void *)iterationId, userName, &ast)) {
-           free(userName);
-           free(who);
-           if (ast == ADMITERATORDONE) {
+       if( !pts_UserListNext( (void *) iterationId, userName, &ast ) ) {
+           free( userName );
+           free( who );
+           if( ast == ADMITERATORDONE ) {
                return NULL;
            } else {
-               throwAFSException(env, ast);
+               throwAFSException( env, ast );
                return NULL;
            }
        }
 
-       if (strcmp(userName, "anonymous") == 0) {
+       if( strcmp( userName, "anonymous" ) == 0 ) {
            continue;
        }
+       
        // make sure the name is within the allowed bounds
-       if (strlen(userName) > KAS_MAX_NAME_LEN) {
-           free(who);
-           free(userName);
-           throwAFSException(env, ADMPTSUSERNAMETOOLONG);
+       if( strlen( userName ) > KAS_MAX_NAME_LEN ) {
+           free( who );
+           free( userName );
+           throwAFSException( env, ADMPTSUSERNAMETOOLONG );
            return NULL;
        }
+       
        // if there is a kas entry, recurse
-       internal_makeKasIdentity(userName, who);
-       if (kas_PrincipalGet((void *)cellHandle, NULL, who, &kasEntry, &ast)) {
+       internal_makeKasIdentity( userName, who );
+       if( kas_PrincipalGet( (void *) cellHandle, NULL, who, 
+                             &kasEntry, &ast ) ) {
            continue;
        }
-
+       
        juser = (*env)->NewStringUTF(env, userName);
-       free(userName);
-       free(who);
+       free( userName );
+       free( who );
        return juser;
+
     }
 
 }
@@ -607,54 +616,55 @@ Java_org_openafs_jafs_Cell_getPtsOnlyUsersNextString(JNIEnv * env, jclass cls,
  *                  the next pts user
  *  returns 0 if there are no more users, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getPtsUsersNext(JNIEnv * env, jclass cls,
-                                          jint cellHandle, jint iterationId,
-                                          jobject juserObject)
-{
-
-    afs_status_t ast;
-    char *userName;
-    jstring juser;
-
-    userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-
-    if (!userName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return 0;
-    }
-
-    if (!pts_UserListNext((void *)iterationId, userName, &ast)) {
-       free(userName);
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getPtsUsersNext (JNIEnv *env, jclass cls, 
+                                              jlong cellHandle, 
+                                              jlong iterationId, 
+                                              jobject juserObject ) {
+    
+  afs_status_t ast;
+  char *userName;
+  jstring juser;
+
+  userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+
+  if( !userName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return 0;    
+  }
+
+  if( !pts_UserListNext( (void *) iterationId, userName, &ast ) ) {
+    free( userName );
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    if (strcmp(userName, "anonymous") == 0) {
-       free(userName);
-       return Java_org_openafs_jafs_Cell_getPtsUsersNext(env, cls,
-                                                         cellHandle,
-                                                         iterationId,
-                                                         juserObject);
-    }
+  if( strcmp( userName, "anonymous" ) == 0 ) {
+    free( userName );
+    return Java_org_openafs_jafs_Cell_getPtsUsersNext( env, cls, 
+                                                         cellHandle, 
+                                                         iterationId, 
+                                                         juserObject );
+  }
+  
+  juser = (*env)->NewStringUTF(env, userName);
 
-    juser = (*env)->NewStringUTF(env, userName);
+  if( userCls == 0 ) {
+    internal_getUserClass( env, juserObject );
+  }
 
-    if (userCls == 0) {
-       internal_getUserClass(env, juserObject);
-    }
+  (*env)->SetObjectField(env, juserObject, user_nameField, juser);
 
-    (*env)->SetObjectField(env, juserObject, user_nameField, juser);
+  getUserInfoChar( env, (void *) cellHandle, userName, juserObject );
+  (*env)->SetBooleanField( env, juserObject, user_cachedInfoField, TRUE );
 
-    getUserInfoChar(env, (int)cellHandle, userName, juserObject);
-    (*env)->SetBooleanField(env, juserObject, user_cachedInfoField, TRUE);
+  free( userName );
+  return 1;
 
-    free(userName);
-    return 1;
 }
 
 /**
@@ -669,75 +679,79 @@ Java_org_openafs_jafs_Cell_getPtsUsersNext(JNIEnv * env, jclass cls,
  *                  the next pts (with no kas) user
  *  returns 0 if there are no more users, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getPtsOnlyUsersNext(JNIEnv * env, jclass cls,
-                                              jint cellHandle,
-                                              jint iterationId,
-                                              jobject juserObject)
-{
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-    kas_principalEntry_t kasEntry;
-    afs_status_t ast;
-    char *userName;
-    jstring juser;
-
-    if (!who) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return 0;
-    }
-
-    userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-
-    if (!userName) {
-       free(who);
-       throwAFSException(env, JAFSADMNOMEM);
-       return 0;
-    }
-
-    while (1) {
-
-       if (!pts_UserListNext((void *)iterationId, userName, &ast)) {
-           free(userName);
-           free(who);
-           if (ast == ADMITERATORDONE) {
-               return 0;
-           } else {
-               throwAFSException(env, ast);
-               return 0;
-           }
-       }
-
-       if (strcmp(userName, "anonymous") == 0) {
-           continue;
-       }
-       // make sure the name is within the allowed bounds
-       if (strlen(userName) > KAS_MAX_NAME_LEN) {
-           free(userName);
-           free(who);
-           throwAFSException(env, ADMPTSUSERNAMETOOLONG);
-           return 0;
-       }
-
-       if (userCls == 0) {
-           internal_getUserClass(env, juserObject);
-       }
-       // if there is a kas entry, recurse
-       internal_makeKasIdentity(userName, who);
-       if (kas_PrincipalGet((void *)cellHandle, NULL, who, &kasEntry, &ast)) {
-           continue;
-       }
-
-       juser = (*env)->NewStringUTF(env, userName);
-
-       (*env)->SetObjectField(env, juserObject, user_nameField, juser);
-       getUserInfoChar(env, (int)cellHandle, userName, juserObject);
-       (*env)->SetBooleanField(env, juserObject, user_cachedInfoField, TRUE);
-
-       free(who);
-       free(userName);
-       return 1;
-
-    }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getPtsOnlyUsersNext (JNIEnv *env, jclass cls, 
+                                                  jlong cellHandle, 
+                                                  jlong iterationId, 
+                                                  jobject juserObject ) {
+
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );
+  kas_principalEntry_t kasEntry;
+  afs_status_t ast;
+  char *userName;
+  jstring juser;
+
+  if( !who ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return 0;    
+  }
+  
+  userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+
+  if( !userName ) {
+    free( who );
+    throwAFSException( env, JAFSADMNOMEM );
+    return 0;    
+  }
+
+  while( 1 ) {
+
+      if( !pts_UserListNext( (void *) iterationId, userName, &ast ) ) {
+         free( userName );
+         free( who );
+         if( ast == ADMITERATORDONE ) {
+             return 0;
+         } else {
+             throwAFSException( env, ast );
+             return 0;
+         }
+      }
+      
+      if( strcmp( userName, "anonymous" ) == 0 ) {
+         continue;
+      }
+      
+      // make sure the name is within the allowed bounds
+      if( strlen( userName ) > KAS_MAX_NAME_LEN ) {
+         free( userName );
+         free( who );
+         throwAFSException( env, ADMPTSUSERNAMETOOLONG );
+         return 0;
+      }
+      
+      if( userCls == 0 ) {
+         internal_getUserClass( env, juserObject );
+      }
+      
+      
+      // if there is a kas entry, recurse
+      internal_makeKasIdentity( userName, who );
+      if( kas_PrincipalGet( (void *) cellHandle, NULL, who, 
+                           &kasEntry, &ast ) ) {
+         continue;
+      } 
+      
+      juser = (*env)->NewStringUTF(env, userName);
+      
+      (*env)->SetObjectField(env, juserObject, user_nameField, juser);
+      getUserInfoChar( env, (void *) cellHandle, userName, juserObject );
+      (*env)->SetBooleanField( env, juserObject, user_cachedInfoField, TRUE );
+      
+      free( who );
+      free( userName );
+      return 1;
+      
+  }
 
 }
 
@@ -748,17 +762,17 @@ Java_org_openafs_jafs_Cell_getPtsOnlyUsersNext(JNIEnv * env, jclass cls,
  *  cls      the current Java class
  *  iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_getPtsUsersDone(JNIEnv * env, jclass cls,
-                                          jint iterationId)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_getPtsUsersDone (JNIEnv *env, jclass cls, 
+                                              jlong iterationId) {
 
-    if (!pts_UserListDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
 
+  if( !pts_UserListDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+  
 }
 
 /**
@@ -770,39 +784,37 @@ Java_org_openafs_jafs_Cell_getPtsUsersDone(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the groups belong
  *  returns total number of groups
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getGroupCount(JNIEnv * env, jclass cls,
-                                        jint cellHandle)
-{
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getGroupCount (JNIEnv *env, jclass cls, 
+                                            jlong cellHandle) {
 
-    afs_status_t ast;
-    void *iterationId;
-    char *groupName;
-    int i = 0;
+  afs_status_t ast;
+  void *iterationId;
+  char *groupName;
+  int i = 0;
 
-    if (!pts_GroupListBegin((void *)cellHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  if( !pts_GroupListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return -1;
-    }
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return -1;
+  }
 
-    while (pts_GroupListNext((void *)iterationId, groupName, &ast))
-       i++;
+  while ( pts_GroupListNext( (void *) iterationId, groupName, &ast ) ) i++;
 
-    free(groupName);
+  free( groupName );
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 /**
@@ -816,19 +828,20 @@ Java_org_openafs_jafs_Cell_getGroupCount(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the groups belong
  *  returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getGroupsBegin(JNIEnv * env, jclass cls,
-                                         jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Cell_getGroupsBegin (JNIEnv *env, jclass cls, 
+                                             jlong cellHandle) {
 
-    if (!pts_GroupListBegin((void *)cellHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  void *iterationId;
+
+  if( !pts_GroupListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -843,36 +856,38 @@ Java_org_openafs_jafs_Cell_getGroupsBegin(JNIEnv * env, jclass cls,
  *  startIndex    the starting base-zero index
  *  returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getGroupsBeginAt(JNIEnv * env, jclass cls,
-                                           jint cellHandle, jint startIndex)
-{
-    afs_status_t ast;
-    void *iterationId;
-    char *groupName;
-    int i;
-
-    groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-
-    if (!pts_GroupListBegin((void *)cellHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return 0;
-    }
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Cell_getGroupsBeginAt (JNIEnv *env, jclass cls, 
+                                               jlong cellHandle, 
+                                               jint startIndex) {
+
+  afs_status_t ast;
+  void *iterationId;
+  char *groupName;
+  int i;
+
+  groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+
+  if( !pts_GroupListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return 0;
+  }
+
+  for ( i = 1; i < startIndex; i++) {
+    if( !pts_GroupListNext( (void *) iterationId, groupName, &ast ) ) {
+      free( groupName );
+      if( ast == ADMITERATORDONE ) {
+        return 0;
+      } else {
+        throwAFSException( env, ast );
+        return 0;
+      }
+    }
+  }
+
+  free( groupName );
+  return (jlong) iterationId;
 
-    for (i = 1; i < startIndex; i++) {
-       if (!pts_GroupListNext((void *)iterationId, groupName, &ast)) {
-           free(groupName);
-           if (ast == ADMITERATORDONE) {
-               return 0;
-           } else {
-               throwAFSException(env, ast);
-               return 0;
-           }
-       }
-    }
-
-    free(groupName);
-    return (jint) iterationId;
 }
 
 /**
@@ -884,34 +899,34 @@ Java_org_openafs_jafs_Cell_getGroupsBeginAt(JNIEnv * env, jclass cls,
  *  iterationId   the iteration ID of this iteration
  *  returns the name of the next user of the cell
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Cell_getGroupsNextString(JNIEnv * env, jclass cls,
-                                              jint iterationId)
-{
-    afs_status_t ast;
-    char *groupName;
-    jstring jgroup;
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Cell_getGroupsNextString (JNIEnv *env, jclass cls, 
+                                                  jlong iterationId) {
 
-    groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  afs_status_t ast;
+  char *groupName;
+  jstring jgroup;
 
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return NULL;
-    }
+  groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    if (!pts_GroupListNext((void *)iterationId, groupName, &ast)) {
-       free(groupName);
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return NULL;
-       }
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( !pts_GroupListNext( (void *) iterationId, groupName, &ast ) ) {
+    free( groupName );
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
     }
+  }
 
-    jgroup = (*env)->NewStringUTF(env, groupName);
-    free(groupName);
-    return jgroup;
+  jgroup = (*env)->NewStringUTF(env, groupName);
+  free( groupName );
+  return jgroup;
 
 }
 
@@ -927,45 +942,46 @@ Java_org_openafs_jafs_Cell_getGroupsNextString(JNIEnv * env, jclass cls,
  *                   the next group
  *  returns 0 if there are no more users, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getGroupsNext(JNIEnv * env, jclass cls,
-                                        jint cellHandle, jint iterationId,
-                                        jobject jgroupObject)
-{
-    afs_status_t ast;
-    char *groupName;
-    jstring jgroup;
-
-    groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getGroupsNext (JNIEnv *env, jclass cls, 
+                                            jlong cellHandle, 
+                                            jlong iterationId, 
+                                            jobject jgroupObject) {
+
+  afs_status_t ast;
+  char *groupName;
+  jstring jgroup;
+
+  groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN );
+
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+      return;    
+  }
+  
+  if( !pts_GroupListNext( (void *) iterationId, groupName, &ast ) ) {
+    free( groupName );
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    if (!pts_GroupListNext((void *)iterationId, groupName, &ast)) {
-       free(groupName);
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
-    }
+  jgroup = (*env)->NewStringUTF(env, groupName);
 
-    jgroup = (*env)->NewStringUTF(env, groupName);
+  if( groupCls == 0 ) {
+    internal_getGroupClass( env, jgroupObject );
+  }
 
-    if (groupCls == 0) {
-       internal_getGroupClass(env, jgroupObject);
-    }
+  (*env)->SetObjectField(env, jgroupObject, group_nameField, jgroup);
+  getGroupInfoChar( env, (void *)cellHandle, groupName, jgroupObject );
+  (*env)->SetBooleanField( env, jgroupObject, group_cachedInfoField, TRUE );
 
-    (*env)->SetObjectField(env, jgroupObject, group_nameField, jgroup);
+  free( groupName );
+  return 1;
 
-    getGroupInfoChar(env, (int)cellHandle, groupName, jgroupObject);
-    (*env)->SetBooleanField(env, jgroupObject, group_cachedInfoField, TRUE);
-
-    free(groupName);
-    return 1;
 }
 
 /**
@@ -975,17 +991,17 @@ Java_org_openafs_jafs_Cell_getGroupsNext(JNIEnv * env, jclass cls,
  *  cls      the current Java class
  *  iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_getGroupsDone(JNIEnv * env, jclass cls,
-                                        jint iterationId)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_getGroupsDone (JNIEnv *env, jclass cls, 
+                                            jlong iterationId) {
 
-    if (!pts_GroupListDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
 
+  if( !pts_GroupListDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+  
 }
 
 /**
@@ -998,19 +1014,20 @@ Java_org_openafs_jafs_Cell_getGroupsDone(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the group belongs
  *  returns an integer reresenting the max group id in a cell
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getMaxGroupID(JNIEnv * env, jclass cls,
-                                        jint cellHandle)
-{
-    afs_status_t ast;
-    jint maxID;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getMaxGroupID (JNIEnv *env, jclass cls, 
+                                            jlong cellHandle) {
 
-    if (!pts_GroupMaxGet((void *)cellHandle, (int *)&maxID, &ast)) {
-       throwAFSException(env, ast);
-       return 0;
-    }
+  afs_status_t ast;
+  int maxID;
+
+  if( !pts_GroupMaxGet( (void *) cellHandle, &maxID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jint)maxID;
 
-    return maxID;
 }
 
 /**
@@ -1022,16 +1039,17 @@ Java_org_openafs_jafs_Cell_getMaxGroupID(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the group belongs
  *  maxID an integer reresenting the new max group id in a cell
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_setMaxGroupID(JNIEnv * env, jclass cls,
-                                        jint cellHandle, jint maxID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_setMaxGroupID (JNIEnv *env, jclass cls, 
+                                            jlong cellHandle, jint maxID) {
+
+  afs_status_t ast;
+
+  if( !pts_GroupMaxSet( (void *) cellHandle, (int) maxID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!pts_GroupMaxSet((void *)cellHandle, (int)maxID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -1044,19 +1062,20 @@ Java_org_openafs_jafs_Cell_setMaxGroupID(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the user belongs
  *  returns an integer reresenting the max user id in a cell
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getMaxUserID(JNIEnv * env, jclass cls,
-                                       jint cellHandle)
-{
-    afs_status_t ast;
-    jint maxID;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getMaxUserID (JNIEnv *env, jclass cls, 
+                                           jlong cellHandle) {
 
-    if (!pts_UserMaxGet((void *)cellHandle, (int *)&maxID, &ast)) {
-       throwAFSException(env, ast);
-       return 0;
-    }
+  afs_status_t ast;
+  int maxID;
+
+  if( !pts_UserMaxGet( (void *) cellHandle, &maxID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jint)maxID;
 
-    return maxID;
 }
 
 /**
@@ -1068,16 +1087,17 @@ Java_org_openafs_jafs_Cell_getMaxUserID(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the user belongs
  *  maxID an integer reresenting the new max user id in a cell
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_setMaxUserID(JNIEnv * env, jclass cls,
-                                       jint cellHandle, jint maxID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_setMaxUserID (JNIEnv *env, jclass cls, 
+                                           jlong cellHandle, jint maxID) {
+
+  afs_status_t ast;
+
+  if( !pts_UserMaxSet( (void *) cellHandle, (int) maxID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!pts_UserMaxSet((void *)cellHandle, (int)maxID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -1089,29 +1109,30 @@ Java_org_openafs_jafs_Cell_setMaxUserID(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the servers belong
  *  returns total number of servers
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getServerCount(JNIEnv * env, jclass cls,
-                                         jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    afs_serverEntry_t servEntry;
-    int i = 0;
-
-    if (!afsclient_AFSServerGetBegin((void *)cellHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
-
-    while (afsclient_AFSServerGetNext((void *)iterationId, &servEntry, &ast))
-       i++;
-
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
-
-    return i;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getServerCount (JNIEnv *env, jclass cls, 
+                                             jlong cellHandle) {
+
+  afs_status_t ast;
+  void *iterationId;
+  afs_serverEntry_t servEntry;
+  int i = 0;
+
+  if( !afsclient_AFSServerGetBegin( (void *) cellHandle, 
+                                   &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
+
+  while ( afsclient_AFSServerGetNext( (void *) iterationId, 
+                                     &servEntry, &ast ) ) i++;
+
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
+
+  return i;
 }
 
 /**
@@ -1124,19 +1145,21 @@ Java_org_openafs_jafs_Cell_getServerCount(JNIEnv * env, jclass cls,
  *  cellHandle    the handle of the cell to which the servers belong
  *  returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getServersBegin(JNIEnv * env, jclass cls,
-                                          jint cellHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Cell_getServersBegin (JNIEnv *env, jclass cls, 
+                                              jlong cellHandle) {
 
-    if (!afsclient_AFSServerGetBegin((void *)cellHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  afs_status_t ast;
+  void *iterationId;
+
+  if( !afsclient_AFSServerGetBegin( (void *) cellHandle, 
+                                   &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -1148,23 +1171,26 @@ Java_org_openafs_jafs_Cell_getServersBegin(JNIEnv * env, jclass cls,
  *  iterationId   the iteration ID of this iteration
  *  returns the name of the next server of the cell
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Cell_getServersNextString(JNIEnv * env, jclass cls,
-                                               jint iterationId)
-{
-    afs_status_t ast;
-    jstring jserver;
-    afs_serverEntry_t servEntry;
-
-    if (!afsclient_AFSServerGetNext((void *)iterationId, &servEntry, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return NULL;
-       }
-    }
-    return jserver;
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Cell_getServersNextString (JNIEnv *env, jclass cls, 
+                                                   jlong iterationId) {
+
+  afs_status_t ast;
+  jstring jserver;
+  afs_serverEntry_t servEntry;
+
+  if( !afsclient_AFSServerGetNext( (void *) iterationId, &servEntry, &ast ) ) {
+      if( ast == ADMITERATORDONE ) {
+         return NULL;
+      } else {
+         throwAFSException( env, ast );
+         return NULL;
+      }
+  }
+  
+  jserver = (*env)->NewStringUTF(env, "not_implemented"); /* psomogyi 20050514 */
+
+  return jserver;
 }
 
 /**
@@ -1179,34 +1205,35 @@ Java_org_openafs_jafs_Cell_getServersNextString(JNIEnv * env, jclass cls,
  *                    of the next server 
  *  returns 0 if there are no more servers, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Cell_getServersNext(JNIEnv * env, jclass cls,
-                                         jint cellHandle, jint iterationId,
-                                         jobject jserverObject)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Cell_getServersNext
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong iterationId,
+   jobject jserverObject)
 {
-    afs_status_t ast;
-    jstring jserver;
-    afs_serverEntry_t servEntry;
-    jintArray jaddress;
-
-    if (!afsclient_AFSServerGetNext((void *)iterationId, &servEntry, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
-    }
-    // get the class fields if need be
-    if (serverCls == 0) {
-       internal_getServerClass(env, jserverObject);
+  afs_status_t ast;
+  jstring jserver;
+  afs_serverEntry_t servEntry;
+  jintArray jaddress;
+
+  if( !afsclient_AFSServerGetNext( (void *) iterationId, &servEntry, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
+
+  // get the class fields if need be
+  if( serverCls == 0 ) {
+    internal_getServerClass( env, jserverObject );
+  }
 
-    fillServerInfo(env, (int)cellHandle, jserverObject, servEntry);
+  fillServerInfo( env, (void *) cellHandle, jserverObject, servEntry );
 
-    (*env)->SetBooleanField(env, jserverObject, server_cachedInfoField, TRUE);
+  (*env)->SetBooleanField( env, jserverObject, server_cachedInfoField, TRUE );
 
-    return 1;
+  return 1;
 }
 
 /**
@@ -1216,16 +1243,17 @@ Java_org_openafs_jafs_Cell_getServersNext(JNIEnv * env, jclass cls,
  *  cls      the current Java class
  *  iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_getServersDone(JNIEnv * env, jclass cls,
-                                         jint iterationId)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_getServersDone
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
+  afs_status_t ast;
+
+  if( !afsclient_AFSServerGetDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!afsclient_AFSServerGetDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -1240,62 +1268,73 @@ Java_org_openafs_jafs_Cell_getServersDone(JNIEnv * env, jclass cls,
  *  readWrite   whether or not this is to be a readwrite mount point
  *  forceCheck  whether or not to check if this volume name exists
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_createMountPoint(JNIEnv * env, jclass cls,
-                                           jint cellHandle,
-                                           jstring jdirectory,
-                                           jstring jvolumeName,
-                                           jboolean readWrite,
-                                           jboolean forceCheck)
-{
-    afs_status_t ast;
-    char *directory;
-    char *volumeName;
-    vol_type_t type;
-    vol_check_t check;
-
-    if (jdirectory != NULL) {
-       directory = getNativeString(env, jdirectory);
-       if (!directory) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLPATH);
-       return;
-    }
-    if (jvolumeName != NULL) {
-       volumeName = getNativeString(env, jvolumeName);
-       if (volumeName == NULL) {
-           free(directory);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(directory);
-       throwAFSException(env, JAFSNULLVOLUME);
-       return;
-    }
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_createMountPoint (JNIEnv *env, jclass cls, 
+                                               jlong cellHandle, 
+                                               jstring jdirectory, 
+                                               jstring jvolumeName, 
+                                               jboolean readWrite, 
+                                               jboolean forceCheck) {
+
+  afs_status_t ast;
+  const char *directory;
+  const char *volumeName;
+  vol_type_t type;
+  vol_check_t check;
+
+  if( jdirectory != NULL ) {
+    directory = (*env)->GetStringUTFChars(env, jdirectory, 0);
+    if( !directory ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    directory = NULL;
+  }
+  if( jvolumeName != NULL ) {
+    volumeName = (*env)->GetStringUTFChars(env, jvolumeName, 0);
+    if( !volumeName ) {
+      if( directory != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jdirectory, directory);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    volumeName = NULL;
+  }
+
+  if( readWrite ) {
+    type = READ_WRITE;
+  } else {
+    type = READ_ONLY;
+  }
+
+  if( forceCheck ) {
+    check = CHECK_VOLUME;
+  } else {
+    check = DONT_CHECK_VOLUME;
+  }
+
+  if( !afsclient_MountPointCreate( (void *) cellHandle, directory, 
+                                  volumeName, type, check, &ast ) ) {
+    if( volumeName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jvolumeName, volumeName);
+    }
+    if( directory != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jdirectory, directory);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( volumeName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jvolumeName, volumeName);
+  }
+  if( directory != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jdirectory, directory);
+  }
 
-    if (readWrite) {
-       type = READ_WRITE;
-    } else {
-       type = READ_ONLY;
-    }
-
-    if (forceCheck) {
-       check = CHECK_VOLUME;
-    } else {
-       check = DONT_CHECK_VOLUME;
-    }
-
-    if (!afsclient_MountPointCreate
-       ((void *)cellHandle, directory, volumeName, type, check, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(directory);
-    free(volumeName);
 }
 
 /*
@@ -1314,100 +1353,133 @@ Java_org_openafs_jafs_Cell_createMountPoint(JNIEnv * env, jclass cls,
  *  lock    whether or not to allow lock access to this user
  *  admin    whether or not to allow admin access to this user
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_setACL(JNIEnv * env, jclass cls,
-                                 jstring jdirectory, jstring juserName,
-                                 jboolean read, jboolean write,
-                                 jboolean lookup, jboolean delete,
-                                 jboolean insert, jboolean lock,
-                                 jboolean admin)
-{
-    afs_status_t ast;
-    char *directory;
-    char *userName;
-    acl_t acl;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_setACL (JNIEnv *env, jclass cls, 
+                                     jstring jdirectory, jstring juserName, 
+                                     jboolean read, jboolean write, 
+                                     jboolean lookup, jboolean delete, 
+                                     jboolean insert, jboolean lock, 
+                                     jboolean admin) {
+
+  afs_status_t ast;
+  const char *directory;
+  const char *userName;
+  acl_t acl;
+
+  // Added by MP
+  if( !afsclient_Init( &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( jdirectory != NULL ) {
+    directory = (*env)->GetStringUTFChars(env, jdirectory, 0);
+    if( !directory ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    directory = NULL;
+  }
+  if( juserName != NULL ) {
+    userName = (*env)->GetStringUTFChars(env, juserName, 0);
+    if( !userName ) {
+      if( directory != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jdirectory, directory);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    userName = NULL;
+  }
+
+  if( read ) {
+    acl.read = READ;
+  } else {
+    acl.read = NO_READ;
+  }
+
+  if( write ) {
+    acl.write = WRITE;
+  } else {
+    acl.write = NO_WRITE;
+  }
+
+  if( lookup ) {
+    acl.lookup = LOOKUP;
+  } else {
+    acl.lookup = NO_LOOKUP;
+  }
+
+  if( delete ) {
+    acl.del = DELETE;
+  } else {
+    acl.del = NO_DELETE;
+  }
+
+  if( insert ) {
+    acl.insert = INSERT;
+  } else {
+    acl.insert = NO_INSERT;
+  }
+
+  if( lock ) {
+    acl.lock = LOCK;
+  } else {
+    acl.lock = NO_LOCK;
+  }
+
+  if( admin ) {
+    acl.admin = ADMIN;
+  } else {
+    acl.admin = NO_ADMIN;
+  }
+
+  if( !afsclient_ACLEntryAdd( directory, userName, &acl, &ast ) ) {
+      if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+      }
+      if( directory != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jdirectory, directory);
+      }
+      throwAFSException( env, ast );
+      return;
+  }
+
+  if( userName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
+  if( directory != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jdirectory, directory);
+  }
+
+}
+
+// reclaim global memory used by this portion
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Cell_reclaimCellMemory (JNIEnv *env, jclass cls) {
+
+}
+
+
+
+
+
+
+
+
+
 
-    if (!afsclient_Init(&ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 
-    if (jdirectory != NULL) {
-       directory = getNativeString(env, jdirectory);
-       if (!directory) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLPATH);
-       return;
-    }
 
-    if (juserName != NULL) {
-       userName = getNativeString(env, juserName);
-       if (!userName) {
-           free(directory);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(directory);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
 
-    if (read) {
-       acl.read = READ;
-    } else {
-       acl.read = NO_READ;
-    }
 
-    if (write) {
-       acl.write = WRITE;
-    } else {
-       acl.write = NO_WRITE;
-    }
 
-    if (lookup) {
-       acl.lookup = LOOKUP;
-    } else {
-       acl.lookup = NO_LOOKUP;
-    }
 
-    if (delete) {
-       acl.del = DELETE;
-    } else {
-       acl.del = NO_DELETE;
-    }
 
-    if (insert) {
-       acl.insert = INSERT;
-    } else {
-       acl.insert = NO_INSERT;
-    }
 
-    if (lock) {
-       acl.lock = LOCK;
-    } else {
-       acl.lock = NO_LOCK;
-    }
 
-    if (admin) {
-       acl.admin = ADMIN;
-    } else {
-       acl.admin = NO_ADMIN;
-    }
 
-    if (!afsclient_ACLEntryAdd(directory, userName, &acl, &ast)) {
-       throwAFSException(env, ast);
-    }
 
-    free(userName);
-    free(directory);
-}
 
-// reclaim global memory used by this portion
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Cell_reclaimCellMemory(JNIEnv * env, jclass cls)
-{
-}
diff --git a/src/JAVA/libjafs/ChangeLog b/src/JAVA/libjafs/ChangeLog
new file mode 100644 (file)
index 0000000..be548ed
--- /dev/null
@@ -0,0 +1,41 @@
+20050524: (by Peter Somogyi somogyi@de.ibm.com)
+       - bugfix: ACL.c: syscall => pioctl (problem on ppc64)
+       - bugfix: ACL.c: memory leak
+       - some minor changes in ACL.c to be more accordance to src/venus/fs.c
+       - bugfix: inet_ntoa crashed; implemented an own function is Server.c instead
+       - modified src/libuafs/MakefileProto.LINUX: added -fPIC flag (doesn't tolerate mixing with non-fPIC on ppc)
+       
+20050525: (somogyi@de.ibm.com)
+       - removed non-error message from getACL; extended the error report (path string) instead of it
+
+20050602: (somogyi@de.ibm.com)
+       - moved ACL.c from libjafs.so into libjafsadm.so
+       (solves pioctl call failure in [get|set]ACL)
+       In the future each one should be in libjafsadm.so - using _only_ AFS API (!!!).
+20050603:
+       - moved GetNativeString from libjafs.so into libjafsadm.so
+20050610:
+       - created an automatic testAFS comprehensive java test
+       - modified java library: made all getInfo-like methods public
+20050614:
+       - bugfix: Cell.c: ..._getServersNextString: return "not_implemented" instead of making a crash
+20050616:
+       - created a multithreaded test; pioctl in getACL fails on i386_linux26, but doesn't fail under ppc64_linux26
+20050617:
+       - [#]ifdef-separated c sources and makefiles for ppc64_linux26
+       - bugfix: eliminating thread-safety crashes on pioctl/i386, but only pioctl works on ppc64 (idef-ed)
+       (pioctl didn't crash on ppc64)
+20050720:
+       - added s390x support, needs some special patches to openafs src
+       - added 64-bit support, affects java part
+       - refined testAFS.java tester tool
+
+20050727:
+       - tested on ppc64/32, fixed some bugs because of some s390x modifications
+
+20050830:
+       - modified Makefile.in to support OpenAFS version 1.3.85 or higher (added util/rxkstats.o to libjafs.so)
+
+20050906:
+       - added version info (overwritting an earlier implementation)
+       - added build info (using AFS_component_version_number.c) which is autogenerated
index f657fa7..1692cfd 100644 (file)
@@ -1,9 +1,12 @@
 #ifndef _Jafsadm_Exceptions
 #define _Jafsadm_Exceptions
 
-static char *afsExceptionName = "org/openafs/jafs/AFSException";
-static char *afsFileExceptionName = "org/openafs/jafs/AFSFileException";
-static char *afsSecurityExceptionName =
-    "org/openafs/jafs/AFSSecurityException";
+static char *afsExceptionName         = "org/openafs/jafs/AFSException";
+static char *afsFileExceptionName     = "org/openafs/jafs/AFSFileException";
+static char *afsSecurityExceptionName = "org/openafs/jafs/AFSSecurityException";
 
 #endif
+
+
+
+
index 4f6e6df..c6c8338 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if 0
 #include <afs/param.h>
 #include <errno.h>
-#endif
 
 #include "Internal.h"
 #include "org_openafs_jafs_File.h"
@@ -31,7 +29,7 @@
 #include <fcntl.h>
 #include <jni.h>
 #include <pthread.h>
-#include <afs/afs_usrops.h>
+/*#include <afs/afs_usrops.h>*/
 #include <afs/prs_fs.h>
 #include <sys/time.h>
 #include <unistd.h>
@@ -49,7 +47,7 @@
 #include "dmalloc.h"
 #endif
 
-void setFileNotExistsAttributes(JNIEnv * env, jobject * obj);
+void setFileNotExistsAttributes(JNIEnv *env, jobject *obj);
 
 typedef struct {
     char *fileName;
@@ -58,16 +56,15 @@ typedef struct {
 
 /*static char compile_date[] = COMPILE_DATE;*/
 
-int
-sub_time(struct timeval *tv1, struct timeval *tv2)
+int sub_time(struct timeval *tv1, struct timeval *tv2)
 {
-    if (tv2->tv_usec > tv1->tv_usec) {
-       tv1->tv_usec += 1000000;
-       tv1->tv_usec -= 1;
-    }
+   if (tv2->tv_usec > tv1->tv_usec) {
+     tv1->tv_usec += 1000000;
+     tv1->tv_usec -= 1;
+   }
 
-    tv1->tv_usec -= tv2->tv_usec;
-    tv1->tv_sec -= tv2->tv_sec;
+   tv1->tv_usec -= tv2->tv_usec;
+   tv1->tv_sec -= tv2->tv_sec;
 }
 
 /**
@@ -77,42 +74,33 @@ sub_time(struct timeval *tv1, struct timeval *tv2)
  * env      the Java environment
  * obj      the current Java object
  */
-char *
-getAbsolutePath(JNIEnv * env, jobject * obj, char *dirName)
+char* getAbsolutePath(JNIEnv *env, jobject *obj, char *dirName)
 {
     jclass thisClass;
     jstring jDirName;
     jmethodID getAbsolutePathID;
-    char *auxDirName;
+    const char *auxDirName;
     jfieldID fid;
 
     thisClass = (*env)->GetObjectClass(env, *obj);
-    if (thisClass == NULL) {
-       fprintf(stderr, "File::getAbsolutePath(): GetObjectClass failed\n");
-       return NULL;
+    if(thisClass == NULL) {
+      fprintf(stderr, "File::getAbsolutePath(): GetObjectClass failed\n");
+      return NULL;
     }
-
     fid = (*env)->GetFieldID(env, thisClass, "path", "Ljava/lang/String;");
-    if (fid == NULL) {
-       fprintf(stderr,
-               "File::getAbsolutePath(): GetFieldID (path) failed\n");
-       return NULL;
+    if (fid == 0) {
+      fprintf(stderr, "File::getAbsolutePath(): GetFieldID (path) failed\n");
+      return NULL;
     }
-
     jDirName = (*env)->GetObjectField(env, *obj, fid);
-    if (jDirName == NULL) {
-       fprintf(stderr, "File::getAbsolutePath(): failed to get file name\n");
-       return NULL;
-    }
 
-    auxDirName = getNativeString(env, jDirName);
-    if (auxDirName == NULL) {
-       fprintf(stderr,
-               "File::getAbsolutePath(): failed to get translated file name\n");
-       return NULL;
+    if(jDirName == NULL) {
+      fprintf(stderr, "File::getAbsolutePath(): failed to get file name\n");
+      return NULL;
     }
+    auxDirName = (*env) -> GetStringUTFChars(env, jDirName, 0);
     strcpy(dirName, auxDirName);
-    free(auxDirName);
+    (*env) -> ReleaseStringUTFChars(env, jDirName, auxDirName);
 }
 
 /**
@@ -130,10 +118,10 @@ getAbsolutePath(JNIEnv * env, jobject * obj, char *dirName)
  *
  * throws AFSException
  */
-JNIEXPORT jboolean JNICALL
-Java_org_openafs_jafs_File_setAttributes(JNIEnv * env, jobject obj)
+JNIEXPORT jboolean JNICALL Java_org_openafs_jafs_File_setAttributes
+  (JNIEnv *env, jobject obj)
 {
-    char target[FILENAME_MAX + 1];
+    char target[FILENAME_MAX+1];
     char dirName[FILENAME_MAX];
     jclass thisClass;
     jfieldID fid;
@@ -145,187 +133,184 @@ Java_org_openafs_jafs_File_setAttributes(JNIEnv * env, jobject obj)
     struct timeval tv0, tv1;
     struct timezone tz;
 
-    /*memset(target, 0, FILENAME_MAX); */
+    /*memset(target, 0, FILENAME_MAX);*/
 
     *dirName = '\0';
     getAbsolutePath(env, &obj, dirName);
 
-    /*fprintf(stderr, "dirName=%s\n", dirName); */
+    /*fprintf(stderr, "dirName=%s\n", dirName);*/
 
-    if (*dirName == '\0') {
-       fprintf(stderr, "File::setAttributes(): failed to get dirName\n");
-       return JNI_FALSE;
+    if(*dirName == '\0') {
+      fprintf(stderr, "File::setAttributes(): failed to get dirName\n");
+      return JNI_FALSE;
     }
 
-    thisClass = (*env)->GetObjectClass(env, obj);
-    if (thisClass == NULL) {
-       fprintf(stderr, "File::setAttributes(): GetObjectClass failed\n");
-       return JNI_FALSE;
+    thisClass = (*env) -> GetObjectClass(env, obj);
+    if(thisClass == NULL) {
+      fprintf(stderr, "File::setAttributes(): GetObjectClass failed\n");
+      return JNI_FALSE;
     }
 
     gettimeofday(&tv0, &tz);
     if ((strcmp(dirName, "/afs") == 0) || (strcmp(dirName, "/afs/") == 0)) {
-       rc = 1;                 /* special case for /afs since statmountpoint fails on it */
+      rc = 1;   /* special case for /afs since statmountpoint fails on it */
     } else {
-       rc = uafs_statmountpoint(dirName);
-       gettimeofday(&tv1, &tz);
-       sub_time(&tv1, &tv0);
-       /*printf("%s: statmountpoint %d.%06d\n", dirName, tv1.tv_sec, tv1.tv_usec); */
-    }
-
-    if (rc < 0) {
-       setError(env, &obj, errno);
-       if (errno == ENOENT) {
-           setFileNotExistsAttributes(env, &obj);
-           return JNI_TRUE;    /* not really an error */
-       } else {
-           fprintf(stderr,
-                   "File::setAttributes(): uafs_statmountpoint failed "
-                   "for %s (%s)\n", dirName, error_message(errno));
-           return JNI_FALSE;
-       }
+      rc = uafs_statmountpoint(dirName);
+      gettimeofday(&tv1, &tz);
+      sub_time(&tv1, &tv0);
+      /*printf("%s: statmountpoint %d.%06d\n", dirName, tv1.tv_sec, tv1.tv_usec);*/
+    }
+
+    if(rc < 0) {
+      setError(env, &obj, errno);
+      if(errno == ENOENT) {
+        setFileNotExistsAttributes(env, &obj);
+        return JNI_TRUE;   /* not really an error */
+      } else {
+        fprintf(stderr, "File::setAttributes(): uafs_statmountpoint failed "
+                        "for %s (%s)\n", dirName, error_message(errno));
+        return JNI_FALSE;
+      }
     }
 
     if (rc == 1) {
-       /* this is an AFS mount point; we don't want to stat it */
-       /* fake up a stat entry instead */
-       mtpoint = 1;
-       st.st_mtime = 0;
-       st.st_size = 2048;
-       st.st_mode = 0;         /* don't match anything */
+      /* this is an AFS mount point; we don't want to stat it */
+      /* fake up a stat entry instead */
+      mtpoint = 1;
+      st.st_mtime = 0;
+      st.st_size = 2048;
+      st.st_mode = 0;  /* don't match anything */
     } else {
-       mtpoint = 0;
-       fid = (*env)->GetFieldID(env, thisClass, "isLink", "Z");
-       if (fid == 0) {
-           fprintf(stderr,
-                   "File::setAttributes(): GetFieldID (isLink) failed\n");
-           setError(env, &obj, -1);
-           return JNI_FALSE;
-       }
-       islink = (*env)->GetBooleanField(env, obj, fid);
-       if (islink != JNI_TRUE) {
-           rc = uafs_lstat(dirName, &st);
-       } else {
-           /* Here we are being called on a link object for the second time,
-            * so we want info on the object pointed to by the link. */
-           fprintf(stderr, "islink = TRUE on file %s\n", dirName);
-           rc = uafs_stat(dirName, &st);
-       }
-
-       if (rc < 0) {
-           setError(env, &obj, errno);
-           fprintf(stderr, "uafs_lstat failed for dir %s: error %d\n",
-                   dirName, errno);
-           if (errno == ENOENT) {
-               setFileNotExistsAttributes(env, &obj);
-               return JNI_TRUE;
-           }
-           fprintf(stderr,
-                   "File::setAttributes(): uafs_stat failed for %s (%s)\n",
-                   dirName, error_message(errno));
-           return JNI_FALSE;
-       }
+      mtpoint = 0;
+      fid = (*env)->GetFieldID(env, thisClass, "isLink", "Z");
+      if (fid == 0) {
+        fprintf(stderr, "File::setAttributes(): GetFieldID (isLink) failed\n");
+        setError(env, &obj, -1);
+        return JNI_FALSE;
+      }
+      islink = (*env)->GetBooleanField(env, obj, fid);
+      if (islink != JNI_TRUE) {
+        rc = uafs_lstat(dirName, &st);
+      } else {
+        /* Here we are being called on a link object for the second time,
+           so we want info on the object pointed to by the link. */
+        fprintf(stderr, "islink = TRUE on file %s\n", dirName);
+        rc = uafs_stat(dirName, &st);
+      }
+
+      if(rc < 0) {
+        setError(env, &obj, errno);
+        fprintf(stderr, "uafs_lstat failed for dir %s: error %d\n",
+                         dirName, errno);
+        if(errno == ENOENT) {
+          setFileNotExistsAttributes(env, &obj);
+          return JNI_TRUE;
+        }
+        fprintf(stderr, 
+            "File::setAttributes(): uafs_stat failed for %s (%s)\n", 
+             dirName, error_message(errno));
+        return JNI_FALSE;
+      }
     }
 
     fid = (*env)->GetFieldID(env, thisClass, "exists", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setAttributes(): GetFieldID (exists) failed\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
+      fprintf(stderr, 
+            "File::setAttributes(): GetFieldID (exists) failed\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
     }
     (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
 
     fid = (*env)->GetFieldID(env, thisClass, "isDirectory", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setAttributes(): GetFieldID (isDirectory) failed\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
+      fprintf(stderr, 
+            "File::setAttributes(): GetFieldID (isDirectory) failed\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
     }
     if ((st.st_mode & S_IFMT) == S_IFDIR && !mtpoint) {
-       (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
+      (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
     } else {
-       (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
+      (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
     }
 
     fid = (*env)->GetFieldID(env, thisClass, "isFile", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setAttributes(): GetFieldID (isFile) failed\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
+      fprintf(stderr, 
+            "File::setAttributes(): GetFieldID (isFile) failed\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
     }
     if ((st.st_mode & S_IFMT) == S_IFREG) {
-       (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
+      (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
     } else {
-       (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
+      (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
     }
 
     fid = (*env)->GetFieldID(env, thisClass, "isLink", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setAttributes(): GetFieldID (isLink) failed\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
-    }
-
-    if (islink != JNI_TRUE) {  /* don't re-process link */
-       if ((st.st_mode & S_IFMT) == S_IFLNK) {
-           (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
-
-           /* Find the target of the link */
-           rc = uafs_readlink(dirName, target, FILENAME_MAX);
-           if (rc < 0) {
-               fprintf(stderr,
-                       "File::setAttributes(): uafs_readlink failed\n");
-               setError(env, &obj, errno);
-               return JNI_FALSE;
-           } else {
-               target[rc] = 0; /* weird that we have to do this */
-               /*fprintf(stderr, "readlink %s succeeded, target=%s, rc=%d\n", dirName,
-                * target, rc); */
-           }
-
-           rc = setString(env, &obj, "target", target);
-           if (rc < 0) {
-               fprintf(stderr, "setString dirName=%s target=%s failed\n",
-                       dirName, target);
-           }
-       } else {
-           (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
-       }
+      fprintf(stderr, 
+            "File::setAttributes(): GetFieldID (isLink) failed\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
+    }
+
+    if (islink != JNI_TRUE) {    /* don't re-process link */
+      if ((st.st_mode & S_IFMT) == S_IFLNK) {
+        (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
+
+        /* Find the target of the link */
+        rc = uafs_readlink(dirName, target, FILENAME_MAX);
+        if (rc < 0) {
+          fprintf(stderr, "File::setAttributes(): uafs_readlink failed\n");
+          setError(env, &obj, errno);
+          return JNI_FALSE;
+        } else {
+          target[rc] = 0;     /* weird that we have to do this */
+          /*fprintf(stderr, "readlink %s succeeded, target=%s, rc=%d\n", dirName,
+            target, rc);*/
+        }
+
+        rc = setString(env, &obj, "target", target);
+        if (rc < 0) {
+          fprintf(stderr, "setString dirName=%s target=%s failed\n",
+                           dirName, target);
+        }
+      } else {
+        (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
+      }
     }
 
     fid = (*env)->GetFieldID(env, thisClass, "isMountPoint", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setAttributes(): GetFieldID (isMountPoint) failed\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
+      fprintf(stderr, 
+            "File::setAttributes(): GetFieldID (isMountPoint) failed\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
     }
 
     if (mtpoint) {
-       (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
+      (*env)->SetBooleanField(env, obj, fid, JNI_TRUE);
     } else {
-       (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
+      (*env)->SetBooleanField(env, obj, fid, JNI_FALSE);
     }
 
     fid = (*env)->GetFieldID(env, thisClass, "lastModified", "J");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setAttributes(): GetFieldID (lastModified) failed\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
+      fprintf(stderr, 
+            "File::setAttributes(): GetFieldID (lastModified) failed\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
     }
-    (*env)->SetLongField(env, obj, fid, ((jlong) st.st_mtime) * 1000);
+    (*env)->SetLongField(env, obj, fid, ((jlong) st.st_mtime)*1000);
 
     fid = (*env)->GetFieldID(env, thisClass, "length", "J");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setAttributes(): GetFieldID (length) failed\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
+      fprintf(stderr, 
+            "File::setAttributes(): GetFieldID (length) failed\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
     }
     (*env)->SetLongField(env, obj, fid, st.st_size);
 
@@ -342,8 +327,8 @@ Java_org_openafs_jafs_File_setAttributes(JNIEnv * env, jobject obj)
  *
  * return  permission/ACL mask
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_File_getRights(JNIEnv * env, jobject obj)
+JNIEXPORT jint JNICALL Java_org_openafs_jafs_File_getRights
+  (JNIEnv *env, jobject obj)
 {
     char dirName[FILENAME_MAX];
     jclass thisClass;
@@ -355,10 +340,10 @@ Java_org_openafs_jafs_File_getRights(JNIEnv * env, jobject obj)
     *dirName = '\0';
     getAbsolutePath(env, &obj, dirName);
 
-    if (*dirName == '\0') {
-       fprintf(stderr, "File::getRights(): failed to get dirName\n");
-       setError(env, &obj, -1);
-       return JNI_FALSE;
+    if(*dirName == '\0') {
+      fprintf(stderr, "File::getRights(): failed to get dirName\n");
+      setError(env, &obj, -1);
+      return JNI_FALSE;
     }
 
     /*-Access Rights-
@@ -374,25 +359,25 @@ Java_org_openafs_jafs_File_getRights(JNIEnv * env, jobject obj)
     rights = 0;
     afs_rights = uafs_getRights(dirName);
     if (afs_rights < 0) {
-       setError(env, &obj, errno);
-       return -1;
+      setError(env, &obj, errno);
+      return -1;
     }
-
+    
     if (afs_rights & PRSFS_READ)
-       rights |= UAFS_READ;
+      rights |= UAFS_READ;
     if (afs_rights & PRSFS_WRITE)
-       rights |= UAFS_WRITE;
+      rights |= UAFS_WRITE;
     if (afs_rights & PRSFS_INSERT)
-       rights |= UAFS_INSERT;
+      rights |= UAFS_INSERT;
     if (afs_rights & PRSFS_LOOKUP)
-       rights |= UAFS_LOOKUP;
+      rights |= UAFS_LOOKUP;
     if (afs_rights & PRSFS_DELETE)
-       rights |= UAFS_DELETE;
+      rights |= UAFS_DELETE;
     if (afs_rights & PRSFS_LOCK)
-       rights |= UAFS_LOCK;
+      rights |= UAFS_LOCK;
     if (afs_rights & PRSFS_ADMINISTER)
-       rights |= UAFS_ADMIN;
-
+      rights |= UAFS_ADMIN;
+    
     return rights;
 }
 
@@ -405,10 +390,11 @@ Java_org_openafs_jafs_File_getRights(JNIEnv * env, jobject obj)
  *
  * return   the directory handle
  */
-JNIEXPORT jlong JNICALL
-Java_org_openafs_jafs_File_listNative(JNIEnv * env, jobject obj,
-                                     jobject buffer)
+JNIEXPORT jlong JNICALL Java_org_openafs_jafs_File_listNative
+  (JNIEnv *env, jobject obj, jobject buffer)
 {
+  return 0;
+#if 0
     char dirName[FILENAME_MAX];
     jclass arrayListClass;
     jmethodID addID;
@@ -417,52 +403,53 @@ Java_org_openafs_jafs_File_listNative(JNIEnv * env, jobject obj,
     struct usr_dirent *enp;
     int i, dirSize;
 
-    *dirName = '\0';
+    *dirName='\0';
     getAbsolutePath(env, &obj, dirName);
-    if (*dirName == '\0') {
-       fprintf(stderr, "File::listNative(): failed to get dirName\n");
-       setError(env, &obj, -1);
-       return 0;
+    if(*dirName == '\0') {
+      fprintf(stderr, "File::listNative(): failed to get dirName\n");
+      setError(env, &obj, -1);
+      return 0;
     }
     arrayListClass = (*env)->GetObjectClass(env, buffer);
-    if (arrayListClass == NULL) {
-       fprintf(stderr, "File::listNative(): GetObjectClass failed\n");
-       setError(env, &obj, -1);
-       return 0;
-    }
-    addID =
-       (*env)->GetMethodID(env, arrayListClass, "add",
-                           "(Ljava/lang/Object;)Z");
-    if (addID == 0) {
-       fprintf(stderr, "File::listNative(): failed to get addID\n");
-       setError(env, &obj, -1);
-       return 0;
+    if(arrayListClass == NULL) {
+      fprintf(stderr, "File::listNative(): GetObjectClass failed\n");
+      setError(env, &obj, -1);
+      return 0;
+    }
+    addID = (*env) -> GetMethodID(env, arrayListClass, "add", 
+                                  "(Ljava/lang/Object;)Z");
+    if(addID == 0) {
+      fprintf(stderr, 
+            "File::listNative(): failed to get addID\n");
+      setError(env, &obj, -1);
+      return 0;
     }
     dirp = uafs_opendir(dirName);
-    if (dirp == NULL) {
-       fprintf(stderr, "File::listNative(): uafs_opendir(%s) failed(%s)\n",
-               dirName, error_message(errno));
-       setError(env, &obj, errno);
-       //throwAFSSecurityException( env, errno );
-       return 0;
-    }
-    while ((enp = uafs_readdir(dirp)) != NULL) {
-       if (strcmp(enp->d_name, ".") == 0 || strcmp(enp->d_name, "..") == 0) {
-           continue;
-       }
-       entryJString = (*env)->NewStringUTF(env, enp->d_name);
-       if (entryJString == NULL) {
-           fprintf(stderr, "File::listNative(): NewStringUTF failed\n");
-           setError(env, &obj, -1);
-           return 0;
+    if(dirp == NULL) {
+      fprintf(stderr, "File::listNative(): uafs_opendir(%s) failed(%s)\n",
+                       dirName, error_message(errno));
+      setError(env, &obj, errno);
+      //throwAFSSecurityException( env, errno );
+      return 0;
+    }
+    while((enp = uafs_readdir(dirp)) != NULL) {
+       if(strcmp(enp->d_name, ".") == 0 || strcmp(enp->d_name, "..") == 0) {
+        continue;
        }
-       (*env)->CallBooleanMethod(env, buffer, addID, entryJString);
+      entryJString = (*env) -> NewStringUTF(env, enp->d_name);
+      if(entryJString == NULL) {
+        fprintf(stderr, "File::listNative(): NewStringUTF failed\n");
+        setError(env, &obj, -1);
+        return 0;
+      }
+      (*env) -> CallBooleanMethod(env, buffer, addID, entryJString);
     }
-    /*uafs_closedir(dirp); */
+    /*uafs_closedir(dirp);*/
 
     setError(env, &obj, 0);
 
     return (jlong) dirp;
+#endif
 }
 
 /**
@@ -473,19 +460,24 @@ Java_org_openafs_jafs_File_listNative(JNIEnv * env, jobject obj,
  *
  * return  true if the directory closes without error
  */
-JNIEXPORT jboolean JNICALL
-Java_org_openafs_jafs_File_closeDir(JNIEnv * env, jobject obj, jlong dp)
+JNIEXPORT jboolean JNICALL Java_org_openafs_jafs_File_closeDir
+  (JNIEnv *env, jobject obj, jlong dp)
 {
-    usr_DIR *dirp = (usr_DIR *) dp;
-    int rc;
 
-    rc = uafs_closedir(dirp);
-    if (rc < 0) {
-       setError(env, &obj, errno);
-       return JNI_FALSE;
-    } else {
-       return JNI_TRUE;
-    }
+  return JNI_TRUE;
+
+#if 0
+  usr_DIR *dirp = (usr_DIR *) dp;
+  int rc;
+  
+  rc = uafs_closedir(dirp);
+  if (rc < 0) {
+    setError(env, &obj, errno);
+    return JNI_FALSE;
+  }
+  else return JNI_TRUE;
+#endif
+
 }
 
 
@@ -497,24 +489,24 @@ Java_org_openafs_jafs_File_closeDir(JNIEnv * env, jobject obj, jlong dp)
  *
  * return  true if the file is removed without error
  */
-JNIEXPORT jboolean JNICALL
-Java_org_openafs_jafs_File_rmfile(JNIEnv * env, jobject obj)
+JNIEXPORT jboolean JNICALL Java_org_openafs_jafs_File_rmfile
+  (JNIEnv *env, jobject obj)
 {
     char dirName[FILENAME_MAX];
     int rc;
 
-    *dirName = '\0';
+    *dirName='\0';
     getAbsolutePath(env, &obj, dirName);
-    if (*dirName == '\0') {
-       setError(env, &obj, EINVAL);
-       fprintf(stderr, "File::rmfile(): failed to get dirName\n");
-       return JNI_FALSE;
+    if(*dirName == '\0') {
+      setError(env, &obj, EINVAL);
+      fprintf(stderr, "File::rmfile(): failed to get dirName\n");
+      return JNI_FALSE;
     }
     rc = uafs_unlink(dirName);
-    if (rc < 0) {
-       setError(env, &obj, errno);
-       fprintf(stderr, "File::rmfile(): uafs_unlink failed\n");
-       return JNI_FALSE;
+    if(rc < 0) {
+      setError(env, &obj, errno);
+      fprintf(stderr, "File::rmfile(): uafs_unlink failed\n");
+      return JNI_FALSE;
     }
     setError(env, &obj, 0);
     return JNI_TRUE;
@@ -528,24 +520,24 @@ Java_org_openafs_jafs_File_rmfile(JNIEnv * env, jobject obj)
  *
  * return  true if the directory is removed without error
  */
-JNIEXPORT jboolean JNICALL
-Java_org_openafs_jafs_File_rmdir(JNIEnv * env, jobject obj)
+JNIEXPORT jboolean JNICALL Java_org_openafs_jafs_File_rmdir
+  (JNIEnv *env, jobject obj)
 {
     char dirName[FILENAME_MAX];
     int rc;
 
-    *dirName = '\0';
+    *dirName='\0';
     getAbsolutePath(env, &obj, dirName);
-    if (*dirName == '\0') {
-       setError(env, &obj, -1);
-       fprintf(stderr, "File::rmdir(): failed to get dirName\n");
-       return JNI_FALSE;
+    if(*dirName == '\0') {
+      setError(env, &obj, -1);
+      fprintf(stderr, "File::rmdir(): failed to get dirName\n");
+      return JNI_FALSE;
     }
     rc = uafs_rmdir(dirName);
-    if (rc < 0) {
-       setError(env, &obj, errno);
-       fprintf(stderr, "File::rmdir(): uafs_unlink failed\n");
-       return JNI_FALSE;
+    if(rc < 0) {
+      setError(env, &obj, errno);
+      fprintf(stderr, "File::rmdir(): uafs_unlink failed\n");
+      return JNI_FALSE;
     }
     setError(env, &obj, 0);
     return JNI_TRUE;
@@ -560,24 +552,24 @@ Java_org_openafs_jafs_File_rmdir(JNIEnv * env, jobject obj)
  * return  true if and only if the directory was
  *          created; false otherwise
  */
-JNIEXPORT jboolean JNICALL
-Java_org_openafs_jafs_File_mkdir(JNIEnv * env, jobject obj)
+JNIEXPORT jboolean JNICALL Java_org_openafs_jafs_File_mkdir
+  (JNIEnv *env, jobject obj)
 {
     char dirName[FILENAME_MAX];
     int rc;
 
-    *dirName = '\0';
+    *dirName='\0';
     getAbsolutePath(env, &obj, dirName);
-    if (*dirName == '\0') {
-       setError(env, &obj, EINVAL);
-       fprintf(stderr, "File::mkdir(): failed to get dirName\n");
-       return JNI_FALSE;
+    if(*dirName == '\0') {
+      setError(env, &obj, EINVAL);
+      fprintf(stderr, "File::mkdir(): failed to get dirName\n");
+      return JNI_FALSE;
     }
     rc = uafs_mkdir(dirName, 0755);
-    if (rc < 0) {
-       setError(env, &obj, errno);
-       fprintf(stderr, "File::mkdir(): uafs_mkdir failed\n");
-       return JNI_FALSE;
+    if(rc < 0) {
+      setError(env, &obj, errno);
+      fprintf(stderr, "File::mkdir(): uafs_mkdir failed\n");
+      return JNI_FALSE;
     }
     setError(env, &obj, 0);
     return JNI_TRUE;
@@ -596,33 +588,31 @@ Java_org_openafs_jafs_File_mkdir(JNIEnv * env, jobject obj)
  * throws   NullPointerException  
  *          If parameter dest is null
  */
-JNIEXPORT jboolean JNICALL
-Java_org_openafs_jafs_File_renameTo(JNIEnv * env, jobject obj,
-                                   jobject newFile)
+JNIEXPORT jboolean JNICALL Java_org_openafs_jafs_File_renameTo
+  (JNIEnv *env, jobject obj, jobject newFile)
 {
     char thisDirName[FILENAME_MAX], newDirName[FILENAME_MAX];
     int rc;
 
-    *thisDirName = '\0';
+    *thisDirName='\0';
     getAbsolutePath(env, &obj, thisDirName);
-    if (*thisDirName == '\0') {
-       setError(env, &obj, -1);
-       fprintf(stderr,
-               "File::renameTo(): failed to get dirName for this \n");
-       return JNI_FALSE;
+    if(*thisDirName == '\0') {
+      setError(env, &obj, -1);
+      fprintf(stderr, "File::renameTo(): failed to get dirName for this \n");
+      return JNI_FALSE;
     }
-    *newDirName = '\0';
+    *newDirName='\0';
     getAbsolutePath(env, &newFile, newDirName);
-    if (*newDirName == '\0') {
-       setError(env, &obj, -1);
-       fprintf(stderr, "File::renameTo(): failed to get dirName for new \n");
-       return JNI_FALSE;
+    if(*newDirName == '\0') {
+      setError(env, &obj, -1);
+      fprintf(stderr, "File::renameTo(): failed to get dirName for new \n");
+      return JNI_FALSE;
     }
     rc = uafs_rename(thisDirName, newDirName);
-    if (rc < 0) {
-       setError(env, &obj, errno);
-       fprintf(stderr, "File::renameTo(): uafs_rename failed\n");
-       return JNI_FALSE;
+    if(rc < 0) {
+      setError(env, &obj, errno);
+      fprintf(stderr, "File::renameTo(): uafs_rename failed\n");
+      return JNI_FALSE;
     }
     return JNI_TRUE;
 }
@@ -634,59 +624,61 @@ Java_org_openafs_jafs_File_renameTo(JNIEnv * env, jobject obj,
  * env      the Java environment
  * obj      the current Java object
  */
-void
-setFileNotExistsAttributes(JNIEnv * env, jobject * obj)
+void setFileNotExistsAttributes
+    (JNIEnv *env, jobject *obj)
 {
     jclass thisClass;
     jfieldID fid;
 
-    thisClass = (*env)->GetObjectClass(env, *obj);
-    if (thisClass == NULL) {
-       fprintf(stderr,
-               "File::setFileNotExistsAttributes(): GetObjectClass failed\n");
-       return;
+    thisClass = (*env) -> GetObjectClass(env, *obj);
+    if(thisClass == NULL) {
+      fprintf(stderr, 
+            "File::setFileNotExistsAttributes(): GetObjectClass failed\n");
+      return;
     }
 
     fid = (*env)->GetFieldID(env, thisClass, "exists", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setFileNotExistsAttributes(): GetFieldID (exists) failed\n");
-       return;
+      fprintf(stderr, 
+            "File::setFileNotExistsAttributes(): GetFieldID (exists) failed\n");
+      return;
     }
     (*env)->SetBooleanField(env, *obj, fid, JNI_FALSE);
 
     fid = (*env)->GetFieldID(env, thisClass, "isDirectory", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setFileNotExistsAttributes(): GetFieldID (isDirectory) failed\n");
-       return;
+      fprintf(stderr, 
+            "File::setFileNotExistsAttributes(): GetFieldID (isDirectory) failed\n");
+      return;
     }
     (*env)->SetBooleanField(env, *obj, fid, JNI_FALSE);
 
     fid = (*env)->GetFieldID(env, thisClass, "isFile", "Z");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setFileNotExistsAttributes(): GetFieldID (isDirectory) failed\n");
-       return;
+      fprintf(stderr, 
+            "File::setFileNotExistsAttributes(): GetFieldID (isDirectory) failed\n");
+      return;
     }
     (*env)->SetBooleanField(env, *obj, fid, JNI_FALSE);
 
     fid = (*env)->GetFieldID(env, thisClass, "lastModified", "J");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setFileNotExistsAttributes(): GetFieldID (lastModified) failed\n");
-       return;
+      fprintf(stderr, 
+            "File::setFileNotExistsAttributes(): GetFieldID (lastModified) failed\n");
+      return;
     }
     (*env)->SetLongField(env, *obj, fid, 0);
 
-
+    
     fid = (*env)->GetFieldID(env, thisClass, "length", "J");
     if (fid == 0) {
-       fprintf(stderr,
-               "File::setFileNotExistsAttributes(): GetFieldID (length) failed\n");
-       return;
+      fprintf(stderr, 
+            "File::setFileNotExistsAttributes(): GetFieldID (length) failed\n");
+      return;
     }
     (*env)->SetLongField(env, *obj, fid, 0);
 
     return;
 }
+
+
index de7dfd0..95b9327 100644 (file)
@@ -33,7 +33,7 @@ extern int errno;
 /**
  * Be carefull with the memory management:
  *
- * - For every getNativeString call the corresponding free().
+ * - For every GetStringUTFChars call the corresponding ReleaseStringUTFChars.
  * - For every Get<type>ArrayElements call the corresponding
  *   Release<type>ArrayElements
  * - For every malloc call the corresponding free.
@@ -51,19 +51,18 @@ extern int errno;
  * @return             file descriptor
  * @exception  AFSFileException  if an I/O or other file related error occurs.
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_FileInputStream_openReadOnly(JNIEnv * env, jobject obj,
-                                                  jstring fileNameUTF)
+JNIEXPORT jint JNICALL Java_org_openafs_jafs_FileInputStream_openReadOnly
+  (JNIEnv *env, jobject obj, jstring fileNameUTF)
 {
-    int err;
-    int fd = -1;               //file descriptor
-
-    fd = openAFSFile(env, fileNameUTF, O_RDONLY, 0, &err);
-    if (fd < 0) {
-       fprintf(stderr, "FileInputStream::openReadOnly(): err=%d\n", err);
-       throwAFSFileException(env, err, NULL);
-    }
-    return fd;
+  int err;
+  int fd = -1;         //file descriptor
+
+  fd = openAFSFile(env, fileNameUTF, O_RDONLY, 0, &err);
+  if (fd < 0) {
+    fprintf(stderr, "FileInputStream::openReadOnly(): err=%d\n", err);
+    throwAFSFileException( env, err, NULL );
+  }
+  return fd;
 }
 
 /**
@@ -82,40 +81,36 @@ Java_org_openafs_jafs_FileInputStream_openReadOnly(JNIEnv * env, jobject obj,
  *                     the file has been reached.
  * @exception  AFSFileException  if an I/O or other file related error occurs.
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_FileInputStream_read(JNIEnv * env, jobject obj,
-                                          jbyteArray jbytes, jint offset,
-                                          jint length)
+JNIEXPORT jint JNICALL Java_org_openafs_jafs_FileInputStream_read
+  (JNIEnv *env, jobject obj, jbyteArray jbytes, jint offset, jint length)
 {
-    int fd, bytesLen, bytesRead;
-    jclass thisClass;
-    jmethodID getFileDescriptorID;
-    jbyte *bytes;
-    jfieldID fid;
-
-    /* If we have to read 0 bytes just return */
-    if (length == 0)
-       return 0;
-
-    thisClass = (*env)->GetObjectClass(env, obj);
-    fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
-    fd = (*env)->GetIntField(env, obj, fid);
-
-    if (fd < 0) {
-       fprintf(stderr, "FileInputStream::read(): invalid file state\n");
-       throwAFSFileException(env, 0, "Invalid file state");
-       return -1;
-    }
-
-    bytes = (*env)->GetByteArrayElements(env, jbytes, 0);
-    bytesLen = (*env)->GetArrayLength(env, jbytes);
-    bytesRead = uafs_read(fd, bytes, bytesLen);
-
-    if (errno != 0)
-       throwAFSFileException(env, errno, NULL);
-
-    (*env)->ReleaseByteArrayElements(env, jbytes, bytes, 0);
-    return (bytesRead > 0) ? bytesRead : -1;
+  int fd, bytesLen, bytesRead;
+  jclass thisClass;
+  jmethodID getFileDescriptorID;
+  jbyte *bytes;
+  jfieldID fid;
+
+  /* If we have to read 0 bytes just return */
+  if(length == 0) return 0;
+
+  thisClass = (*env)->GetObjectClass(env, obj);
+  fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
+  fd = (*env)->GetIntField(env, obj, fid);
+
+  if(fd < 0) {
+    fprintf(stderr, "FileInputStream::read(): invalid file state\n");
+    throwAFSFileException(env, 0, "Invalid file state");
+    return -1;
+  }
+
+  bytes = (*env) -> GetByteArrayElements(env, jbytes, 0);
+  bytesLen = (*env) -> GetArrayLength(env, jbytes);
+  bytesRead = uafs_read(fd, bytes, bytesLen);
+
+  if (errno != 0) throwAFSFileException(env, errno, NULL);
+
+  (*env) -> ReleaseByteArrayElements(env, jbytes, bytes, 0);
+  return (bytesRead > 0) ? bytesRead : -1;
 }
 
 /**
@@ -128,28 +123,31 @@ Java_org_openafs_jafs_FileInputStream_read(JNIEnv * env, jobject obj,
  *
  * @exception  AFSFileException  if an I/O or other file related error occurs.
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_FileInputStream_close(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_FileInputStream_close
+  (JNIEnv *env, jobject obj)
 {
-    int fd, rc;
-    jclass thisClass;
-    jmethodID getFileDescriptorID;
-    jfieldID fid;
-    char *bytes;
-
-    thisClass = (*env)->GetObjectClass(env, obj);
-    fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
-    fd = (*env)->GetIntField(env, obj, fid);
-
-    if (fd < 0) {
-       fprintf(stderr, "FileInputStream::close(): invalid file state\n");
-       throwAFSFileException(env, 0, "Invalid file state");
-       return;
-    }
-
-    rc = uafs_close(fd);
-
-    if (rc != 0) {
-       throwAFSFileException(env, errno, NULL);
-    }
+  int fd, rc;
+  jclass thisClass;
+  jmethodID getFileDescriptorID;
+  jfieldID fid;
+  char *bytes;
+
+  thisClass = (*env)->GetObjectClass(env, obj);
+  fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
+  fd = (*env)->GetIntField(env, obj, fid);
+
+  if(fd < 0) {
+    fprintf(stderr, "FileInputStream::close(): invalid file state\n");
+    throwAFSFileException(env, 0, "Invalid file state");
+    return;
+  }
+
+  rc = uafs_close(fd);
+
+  if (rc != 0) {
+    throwAFSFileException(env, errno, NULL);
+  }
 }
+
+
+
index 185297c..e728da1 100644 (file)
@@ -36,7 +36,7 @@
 /**
  * Be carefull with the memory management:
  *
- * - For every getNativeString call the corresponding free().
+ * - For every GetStringUTFChars call the corresponding ReleaseStringUTFChars.
  * - For every Get<type>ArrayElements call the corresponding
  *   Release<type>ArrayElements
  * - For every malloc call the corresponding free.
  * @returns            file descriptor
  * @exception  AFSFileException  if an I/O or other file related error occurs.
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_FileOutputStream_openWrite(JNIEnv * env, jobject obj,
-                                                jstring fileNameUTF)
+JNIEXPORT jint JNICALL Java_org_openafs_jafs_FileOutputStream_openWrite
+  (JNIEnv *env, jobject obj, jstring fileNameUTF)
 {
-    int err;
-    jint fd = -1;              //file descriptor
-
-    fd = openAFSFile(env, fileNameUTF, O_CREAT | O_TRUNC, 0644, &err);
-    if (fd < 0) {
-       fprintf(stderr, "FileOutputStream::openWrite(): err=%d\n", err);
-       throwAFSFileException(env, err, NULL);
-    }
-    return fd;
+  int err;
+  jint fd = -1;                //file descriptor
+
+  fd = openAFSFile(env, fileNameUTF, O_CREAT | O_TRUNC, 0644, &err);
+  if (fd < 0) {
+    fprintf(stderr, "FileOutputStream::openWrite(): err=%d\n", err);
+    throwAFSFileException(env, err, NULL);
+  }
+  return fd;
 }
 
 /**
@@ -79,19 +78,18 @@ Java_org_openafs_jafs_FileOutputStream_openWrite(JNIEnv * env, jobject obj,
  * @return             file descriptor
  * @exception  AFSFileException  if an I/O or other file related error occurs.
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_FileOutputStream_openAppend(JNIEnv * env, jobject obj,
-                                                 jstring fileNameUTF)
+JNIEXPORT jint JNICALL Java_org_openafs_jafs_FileOutputStream_openAppend
+  (JNIEnv *env, jobject obj, jstring fileNameUTF)
 {
-    int err;
-    jint fd = -1;              //file descriptor
-
-    fd = openAFSFile(env, fileNameUTF, O_CREAT | O_APPEND, 0644, &err);
-    if (fd < 0) {
-       fprintf(stderr, "FileOutputStream::openAppend(): err=%d\n", err);
-       throwAFSFileException(env, err, NULL);
-    }
-    return fd;
+  int err;
+  jint fd = -1;                //file descriptor
+
+  fd = openAFSFile(env, fileNameUTF, O_CREAT | O_APPEND, 0644, &err);
+  if (fd < 0) {
+    fprintf(stderr, "FileOutputStream::openAppend(): err=%d\n", err);
+    throwAFSFileException(env, err, NULL);
+  }
+  return fd;
 }
 
 /**
@@ -106,10 +104,8 @@ Java_org_openafs_jafs_FileOutputStream_openAppend(JNIEnv * env, jobject obj,
  *
  * @exception  AFSFileException  if an I/O or other file related error occurs.
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_FileOutputStream_write(JNIEnv * env, jobject obj,
-                                            jbyteArray jbytes, jint offset,
-                                            jint length)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_FileOutputStream_write
+  (JNIEnv *env, jobject obj, jbyteArray jbytes, jint offset, jint length)
 {
     int fd, written, toWrite;
     jint twritten;
@@ -121,32 +117,28 @@ Java_org_openafs_jafs_FileOutputStream_write(JNIEnv * env, jobject obj,
     thisClass = (*env)->GetObjectClass(env, obj);
     fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
     fd = (*env)->GetIntField(env, obj, fid);
-    if (fd < 0) {
-       fprintf(stderr, "FileOutputStream::write(): failed to get file 
-                       descriptor\n");
-       throwAFSFileException(env, 0, "Failed to get file descriptor!");
+    if(fd < 0) {
+      fprintf(stderr, "FileOutputStream::write(): failed to get file "
+                       "descriptor\n");
+      throwAFSFileException(env, 0, "Failed to get file descriptor!");
     }
-
-    bytes = (char *)malloc(length);
-    if (bytes == NULL) {
-       fprintf(stderr,
-               "FileOutputStream::write(): malloc failed of %d bytes\n",
-               length);
-       throwAFSFileException(env, 0, "Failed to allocate memory!");
+    bytes = (char*) malloc(length);
+    if(bytes == NULL) {
+      fprintf(stderr, "FileOutputStream::write(): malloc failed of %d bytes\n",
+                       length);
+      throwAFSFileException(env, 0, "Failed to allocate memory!");
     }
-
-    (*env)->GetByteArrayRegion(env, jbytes, offset, length, bytes);
+    (*env) -> GetByteArrayRegion(env, jbytes, offset, length, bytes);
     toWrite = length;
     twritten = 0;
-
-    while (toWrite > 0) {
-       written = uafs_write(fd, bytes, length);
-       twritten += written;
-       if (written < 0) {
-           free(bytes);
-           throwAFSFileException(env, errno, NULL);
-       }
-       toWrite -= written;
+    while(toWrite>0) {
+      written = uafs_write(fd, bytes, length);
+      twritten += written;
+      if(written<0) {
+        free(bytes);
+        throwAFSFileException(env, errno, NULL);
+      }
+      toWrite -= written;
     }
     free(bytes);
 }
@@ -161,8 +153,8 @@ Java_org_openafs_jafs_FileOutputStream_write(JNIEnv * env, jobject obj,
  *
  * @exception  AFSFileException  if an I/O or other file related error occurs.
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_FileOutputStream_close(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_FileOutputStream_close
+  (JNIEnv *env, jobject obj)
 {
     int fd, rc;
     jclass thisClass;
@@ -173,13 +165,14 @@ Java_org_openafs_jafs_FileOutputStream_close(JNIEnv * env, jobject obj)
     thisClass = (*env)->GetObjectClass(env, obj);
     fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I");
     fd = (*env)->GetIntField(env, obj, fid);
-    if (fd < 0) {
-       fprintf(stderr,
-               "FileOutputStream::close(): failed to get file descriptor\n");
-       throwAFSFileException(env, 0, "Failed to get file descriptor!");
+    if(fd < 0) {
+      fprintf(stderr, "FileOutputStream::close(): failed to get file descriptor\n");
+      throwAFSFileException(env, 0, "Failed to get file descriptor!");
     }
     rc = uafs_close(fd);
     if (rc != 0) {
-       throwAFSFileException(env, rc, NULL);
+      throwAFSFileException(env, rc, NULL);
     }
 }
+
+
diff --git a/src/JAVA/libjafs/GetNativeString.c b/src/JAVA/libjafs/GetNativeString.c
new file mode 100644 (file)
index 0000000..209ba90
--- /dev/null
@@ -0,0 +1,49 @@
+
+#include <jni.h>
+#include "GetNativeString.h"
+
+char* GetNativeString(JNIEnv *env, jstring jstr){
+  jbyteArray bytes = 0;
+  jthrowable exc;
+  char *result = 0;
+  
+  if ((*env)->EnsureLocalCapacity(env, 2) < 0) {
+    return 0; /* out of memory error */
+  }
+  
+  jclass stringClass=(*env)->FindClass(env,"java/lang/String");
+
+  if(!stringClass){
+    return 0;
+  }
+
+  jmethodID  MID_String_getBytes = (*env)->GetMethodID(env,stringClass,"getBytes","()[B");
+  if(!MID_String_getBytes){
+    return 0;
+  }
+
+  bytes = (*env)->CallObjectMethod(env, jstr,
+                                  MID_String_getBytes);
+  exc = (*env)->ExceptionOccurred(env);
+  if (!exc) {
+    jint len = (*env)->GetArrayLength(env, bytes);
+    result = (char *)malloc(len + 1);
+    if (result == 0) {
+
+      /*JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
+       0);*/
+
+      (*env)->DeleteLocalRef(env, bytes);
+      return 0;
+    }
+    (*env)->GetByteArrayRegion(env, bytes, 0, len,
+                              (jbyte *)result);
+    result[len] = 0; /* NULL-terminate */
+  } else {
+    (*env)->DeleteLocalRef(env, exc);
+  }
+  (*env)->DeleteLocalRef(env, bytes);
+     return result;  
+}
+
+jstring GetJavaString(JNIEnv *env, char*);
diff --git a/src/JAVA/libjafs/GetNativeString.h b/src/JAVA/libjafs/GetNativeString.h
new file mode 100644 (file)
index 0000000..7546982
--- /dev/null
@@ -0,0 +1,6 @@
+
+#include <jni.h>
+#include <stdlib.h>
+
+char* GetNativeString(JNIEnv *env, jstring jstr);
+jstring GetJavaString(JNIEnv *env, char*);
index 1dcb557..93b715c 100644 (file)
@@ -65,60 +65,70 @@ extern jfieldID group_creatorField;
  * gid     the group id to assign to the group (0 to have one 
  *                automatically assigned)
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_create(JNIEnv * env, jclass cls, jint cellHandle,
-                                  jstring jgroupName, jstring jownerName,
-                                  jint gid)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_create
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jgroupName, 
+   jstring jownerName, jint gid )
 {
-    afs_status_t ast;
-    // convert java strings
-    char *groupName;
-    char *ownerName;
-
-    if (jgroupName != NULL) {
-       groupName = getNativeString(env, jgroupName);
-       if (groupName == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
+  afs_status_t ast;
+  // convert java strings
+  const char *groupName;
+  const char *ownerName;
+
+  if( jgroupName != NULL ) {
+    groupName = (*env)->GetStringUTFChars(env, jgroupName, 0);
+    if( !groupName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    groupName = NULL;
+  }
+
+  if( jownerName != NULL ) {
+    ownerName = (*env)->GetStringUTFChars(env, jownerName, 0);
+    if( !ownerName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    ownerName = NULL;
+  }
+
+  // make sure the name is within the allowed bounds
+  if( groupName != NULL && strlen( groupName ) > PTS_MAX_NAME_LEN ) {
+    // release converted java strings
+    if( groupName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+    }
+    if( ownerName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jownerName, ownerName);
+    }
+    throwAFSException( env, ADMPTSGROUPNAMETOOLONG );
+    return;
+  }
+  
+  if( !pts_GroupCreate( (void *) cellHandle, groupName, ownerName, 
+                       (int *) &gid, &ast ) ) {
+    // release converted java strings
+    if( groupName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
     }
-
-    if (jownerName != NULL) {
-       ownerName = getNativeString(env, jownerName);
-       if (ownerName == NULL) {
-           free(groupName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(groupName);
-       throwAFSException(env, JAFSNULLOWNER);
-       return;
+    if( ownerName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jownerName, ownerName);
     }
+    throwAFSException( env, ast );
+    return;
+  }
 
-    // make sure the name is within the allowed bounds
-    if (strlen(groupName) > PTS_MAX_NAME_LEN) {
-       // release converted java strings
-       free(groupName);
-       free(ownerName);
-       throwAFSException(env, ADMPTSGROUPNAMETOOLONG);
-       return;
-    }
+  // release converted java strings
+  if( groupName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+  }
+  if( ownerName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jownerName, ownerName);
+  }
 
-    if (!pts_GroupCreate
-       ((void *)cellHandle, groupName, ownerName, (int *)&gid, &ast)) {
-       // release converted java strings
-       free(groupName);
-       free(ownerName);
-       throwAFSException(env, ast);
-       return;
-    }
-    // release converted java strings
-    free(groupName);
-    free(ownerName);
 }
 
 /**
@@ -131,30 +141,37 @@ Java_org_openafs_jafs_Group_create(JNIEnv * env, jclass cls, jint cellHandle,
  * cellHandle    the handle of the cell to which the group belongs
  * jgroupName      the name of the group to delete
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_delete(JNIEnv * env, jclass cls, jint cellHandle,
-                                  jstring jgroupName)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_delete
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jgroupName )
 {
-    afs_status_t ast;
-    // convert java strings
-    char *groupName;
-
-    if (jgroupName != NULL) {
-       groupName = getNativeString(env, jgroupName);
-       if (!groupName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
+  afs_status_t ast;
+  // convert java strings
+  const char *groupName;
+
+  if( jgroupName != NULL ) {
+    groupName = (*env)->GetStringUTFChars(env, jgroupName, 0);
+    if( !groupName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    groupName = NULL;
+  }
+
+  if( !pts_GroupDelete( (void *) cellHandle, groupName, &ast ) ) {
+    if( groupName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+  
+  // release converted java strings
+  if( groupName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+  }
 
-    if (!pts_GroupDelete((void *)cellHandle, groupName, &ast)) {
-       throwAFSException(env, ast);
-    }
-    // release converted java strings
-    free(groupName);
 }
 
 /**
@@ -166,91 +183,92 @@ Java_org_openafs_jafs_Group_delete(JNIEnv * env, jclass cls, jint cellHandle,
  * name      the name of the group for which to get the info
  * group      the Group object to populate with the info
  */
-void
-getGroupInfoChar(JNIEnv * env, jint cellHandle, const char *name,
-                jobject group)
+void getGroupInfoChar
+  ( JNIEnv *env, void *cellHandle, const char *name, jobject group )
 {
 
-    jstring jowner;
-    jstring jcreator;
-    pts_GroupEntry_t entry;
-    afs_status_t ast;
-    // get the field ids if you haven't already
-    if (groupCls == 0) {
-       internal_getGroupClass(env, group);
-    }
-
-    if (!pts_GroupGet((void *)cellHandle, name, &entry, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
-    // set the fields
-    (*env)->SetIntField(env, group, group_nameUidField, entry.nameUid);
-    (*env)->SetIntField(env, group, group_ownerUidField, entry.ownerUid);
-    (*env)->SetIntField(env, group, group_creatorUidField, entry.creatorUid);
-    (*env)->SetIntField(env, group, group_membershipCountField,
-                       entry.membershipCount);
-
-    if (entry.listStatus == PTS_GROUP_OWNER_ACCESS) {
-       (*env)->SetIntField(env, group, group_listStatusField,
-                           org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
-    } else if (entry.listStatus == PTS_GROUP_ACCESS) {
-       (*env)->SetIntField(env, group, group_listStatusField,
-                           org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
-    } else {
-       (*env)->SetIntField(env, group, group_listStatusField,
-                           org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
-    }
-
-    if (entry.listGroupsOwned == PTS_GROUP_OWNER_ACCESS) {
-       (*env)->SetIntField(env, group, group_listGroupsOwnedField,
-                           org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
-    } else if (entry.listGroupsOwned == PTS_GROUP_ACCESS) {
-       (*env)->SetIntField(env, group, group_listGroupsOwnedField,
-                           org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
-    } else {
-       (*env)->SetIntField(env, group, group_listGroupsOwnedField,
-                           org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
-    }
-
-    if (entry.listMembership == PTS_GROUP_OWNER_ACCESS) {
-       (*env)->SetIntField(env, group, group_listMembershipField,
-                           org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
-    } else if (entry.listMembership == PTS_GROUP_ACCESS) {
-       (*env)->SetIntField(env, group, group_listMembershipField,
-                           org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
-    } else {
-       (*env)->SetIntField(env, group, group_listMembershipField,
-                           org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
-    }
-
-    if (entry.listAdd == PTS_GROUP_OWNER_ACCESS) {
-       (*env)->SetIntField(env, group, group_listAddField,
-                           org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
-    } else if (entry.listAdd == PTS_GROUP_ACCESS) {
-       (*env)->SetIntField(env, group, group_listAddField,
-                           org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
-    } else {
-       (*env)->SetIntField(env, group, group_listAddField,
-                           org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
-    }
-
-    if (entry.listDelete == PTS_GROUP_OWNER_ACCESS) {
-       (*env)->SetIntField(env, group, group_listDeleteField,
-                           org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
-    } else if (entry.listDelete == PTS_GROUP_ACCESS) {
-       (*env)->SetIntField(env, group, group_listDeleteField,
-                           org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
-    } else {
-       (*env)->SetIntField(env, group, group_listDeleteField,
-                           org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
-    }
-
-    jowner = (*env)->NewStringUTF(env, entry.owner);
-    jcreator = (*env)->NewStringUTF(env, entry.creator);
+  jstring jowner;
+  jstring jcreator;
+  pts_GroupEntry_t entry;
+  afs_status_t ast;
+
+  // get the field ids if you haven't already
+  if( groupCls == 0 ) {
+    internal_getGroupClass( env, group );
+  }
+  if ( !pts_GroupGet( cellHandle, name, &entry, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  // set the fields
+  (*env)->SetIntField(env, group, group_nameUidField, entry.nameUid);
+  (*env)->SetIntField(env, group, group_ownerUidField, entry.ownerUid);
+  (*env)->SetIntField(env, group, group_creatorUidField, entry.creatorUid);
+  (*env)->SetIntField(env, group, group_membershipCountField, 
+                     entry.membershipCount);
+
+  if( entry.listStatus == PTS_GROUP_OWNER_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listStatusField, 
+                         org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
+  } else if( entry.listStatus == PTS_GROUP_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listStatusField, 
+                         org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
+  } else {
+      (*env)->SetIntField(env, group, group_listStatusField, 
+                         org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
+  }
+
+  if( entry.listGroupsOwned == PTS_GROUP_OWNER_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listGroupsOwnedField, 
+                         org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
+  } else if( entry.listGroupsOwned == PTS_GROUP_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listGroupsOwnedField, 
+                         org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
+  } else {
+      (*env)->SetIntField(env, group, group_listGroupsOwnedField, 
+                         org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
+  }
+
+  if( entry.listMembership == PTS_GROUP_OWNER_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listMembershipField, 
+                         org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
+  } else if( entry.listMembership == PTS_GROUP_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listMembershipField, 
+                         org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
+  } else {
+      (*env)->SetIntField(env, group, group_listMembershipField, 
+                         org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
+  }
+
+  if( entry.listAdd == PTS_GROUP_OWNER_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listAddField, 
+                         org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
+  } else if( entry.listAdd == PTS_GROUP_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listAddField, 
+                         org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
+  } else {
+      (*env)->SetIntField(env, group, group_listAddField, 
+                         org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
+  }
+
+  if( entry.listDelete == PTS_GROUP_OWNER_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listDeleteField, 
+                         org_openafs_jafs_Group_GROUP_OWNER_ACCESS);
+  } else if( entry.listDelete == PTS_GROUP_ACCESS ) {
+      (*env)->SetIntField(env, group, group_listDeleteField, 
+                         org_openafs_jafs_Group_GROUP_GROUP_ACCESS);
+  } else {
+      (*env)->SetIntField(env, group, group_listDeleteField, 
+                         org_openafs_jafs_Group_GROUP_ANYUSER_ACCESS);
+  }
+
+  jowner = (*env)->NewStringUTF(env, entry.owner);
+  jcreator =  (*env)->NewStringUTF(env, entry.creator);
+
+  (*env)->SetObjectField(env, group, group_ownerField, jowner);
+  (*env)->SetObjectField(env, group, group_creatorField, jcreator);
 
-    (*env)->SetObjectField(env, group, group_ownerField, jowner);
-    (*env)->SetObjectField(env, group, group_creatorField, jcreator);
 }
 
 /**
@@ -264,33 +282,36 @@ getGroupInfoChar(JNIEnv * env, jint cellHandle, const char *name,
  * group     the Group object in which to fill in the 
  *                  information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_getGroupInfo(JNIEnv * env, jclass cls,
-                                        jint cellHandle, jstring jname,
-                                        jobject group)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_getGroupInfo
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname, jobject group)
 {
-    char *name;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (!name) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
-    getGroupInfoChar(env, cellHandle, name, group);
 
-    // get class fields if need be
-    if (groupCls == 0) {
-       internal_getGroupClass(env, group);
+  const char *name;
+
+  if( jname != NULL ) {
+    name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
-    // set name in case blank object
-    (*env)->SetObjectField(env, group, group_nameField, jname);
+  } else {
+    name = NULL;
+  }
+  getGroupInfoChar( env, (void *)cellHandle, name, group );
+
+  // get class fields if need be
+  if( groupCls == 0 ) {
+    internal_getGroupClass( env, group );
+  }
+
+  // set name in case blank object
+  (*env)->SetObjectField(env, group, group_nameField, jname);
+
+  if( name != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
 
-    free(name);
 }
 
 /**
@@ -302,86 +323,91 @@ Java_org_openafs_jafs_Group_getGroupInfo(JNIEnv * env, jclass cls,
  * name     the name of the user for which to set the information
  * theGroup   the group object containing the desired information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_setGroupInfo(JNIEnv * env, jclass cls,
-                                        jint cellHandle, jstring jname,
-                                        jobject group)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_setGroupInfo
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname, jobject group)
 {
-    char *name;
-    pts_GroupUpdateEntry_t ptsEntry;
-    afs_status_t ast;
-
-    jint jlistStatus;
-    jint jlistGroupsOwned;
-    jint jlistMembership;
-    jint jlistAdd;
-    jint jlistDelete;
-
-    // get the field ids if you haven't already
-    if (groupCls == 0) {
-       internal_getGroupClass(env, group);
-    }
-
-    jlistStatus = (*env)->GetIntField(env, group, group_listStatusField);
-    jlistGroupsOwned =
-       (*env)->GetIntField(env, group, group_listGroupsOwnedField);
-    jlistMembership =
-       (*env)->GetIntField(env, group, group_listMembershipField);
-    jlistAdd = (*env)->GetIntField(env, group, group_listAddField);
-    jlistDelete = (*env)->GetIntField(env, group, group_listDeleteField);
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
+  const char *name;
+  pts_GroupUpdateEntry_t ptsEntry;
+  afs_status_t ast;
+
+  jint jlistStatus;
+  jint jlistGroupsOwned;
+  jint jlistMembership;
+  jint jlistAdd;
+  jint jlistDelete;
+
+  // get the field ids if you haven't already
+  if( groupCls == 0 ) {
+    internal_getGroupClass( env, group );
+  }
+
+  jlistStatus = (*env)->GetIntField(env, group, group_listStatusField);
+  jlistGroupsOwned = (*env)->GetIntField(env, group, 
+                                        group_listGroupsOwnedField);
+  jlistMembership = (*env)->GetIntField(env, group, group_listMembershipField);
+  jlistAdd = (*env)->GetIntField(env, group, group_listAddField);
+  jlistDelete = (*env)->GetIntField(env, group, group_listDeleteField);
+
+  if( jname != NULL ) {
+    name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    name = NULL;
+  }
+
+  if( jlistStatus == org_openafs_jafs_Group_GROUP_OWNER_ACCESS ) {
+    ptsEntry.listStatus = PTS_GROUP_OWNER_ACCESS;
+  } else if( jlistStatus == org_openafs_jafs_Group_GROUP_GROUP_ACCESS ) {
+    ptsEntry.listStatus = PTS_GROUP_ACCESS;
+  } else {
+    ptsEntry.listStatus = PTS_GROUP_ANYUSER_ACCESS;
+  }
+  if( jlistGroupsOwned == org_openafs_jafs_Group_GROUP_OWNER_ACCESS ) {
+    ptsEntry.listGroupsOwned = PTS_GROUP_OWNER_ACCESS;
+  } else if( jlistGroupsOwned == 
+            org_openafs_jafs_Group_GROUP_GROUP_ACCESS ) {
+    ptsEntry.listGroupsOwned = PTS_GROUP_ACCESS;
+  } else {
+    ptsEntry.listGroupsOwned = PTS_GROUP_ANYUSER_ACCESS;
+  }
+  if( jlistMembership == org_openafs_jafs_Group_GROUP_OWNER_ACCESS ) {
+    ptsEntry.listMembership = PTS_GROUP_OWNER_ACCESS;
+  } else if( jlistMembership == 
+            org_openafs_jafs_Group_GROUP_GROUP_ACCESS ) {
+    ptsEntry.listMembership = PTS_GROUP_ACCESS;
+  } else {
+    ptsEntry.listMembership = PTS_GROUP_ANYUSER_ACCESS;
+  }
+  if( jlistAdd == org_openafs_jafs_Group_GROUP_OWNER_ACCESS ) {
+    ptsEntry.listAdd = PTS_GROUP_OWNER_ACCESS;
+  } else if( jlistAdd == org_openafs_jafs_Group_GROUP_GROUP_ACCESS ) {
+    ptsEntry.listAdd = PTS_GROUP_ACCESS;
+  } else {
+    ptsEntry.listAdd = PTS_GROUP_ANYUSER_ACCESS;
+  }
+  if( jlistDelete == org_openafs_jafs_Group_GROUP_OWNER_ACCESS ) {
+    ptsEntry.listDelete = PTS_GROUP_OWNER_ACCESS;
+  } else if( jlistDelete == org_openafs_jafs_Group_GROUP_GROUP_ACCESS ) {
+    ptsEntry.listDelete = PTS_GROUP_ACCESS;
+  } else {
+    ptsEntry.listDelete = PTS_GROUP_ANYUSER_ACCESS;
+  }
+  if( !pts_GroupModify( (void *) cellHandle, name, &ptsEntry, &ast ) ) {
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
+    }
+    throwAFSException( env, ast );
+    return;    
+  }
+
+  if( name != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
 
-    if (jlistStatus == org_openafs_jafs_Group_GROUP_OWNER_ACCESS) {
-       ptsEntry.listStatus = PTS_GROUP_OWNER_ACCESS;
-    } else if (jlistStatus == org_openafs_jafs_Group_GROUP_GROUP_ACCESS) {
-       ptsEntry.listStatus = PTS_GROUP_ACCESS;
-    } else {
-       ptsEntry.listStatus = PTS_GROUP_ANYUSER_ACCESS;
-    }
-    if (jlistGroupsOwned == org_openafs_jafs_Group_GROUP_OWNER_ACCESS) {
-       ptsEntry.listGroupsOwned = PTS_GROUP_OWNER_ACCESS;
-    } else if (jlistGroupsOwned == org_openafs_jafs_Group_GROUP_GROUP_ACCESS) {
-       ptsEntry.listGroupsOwned = PTS_GROUP_ACCESS;
-    } else {
-       ptsEntry.listGroupsOwned = PTS_GROUP_ANYUSER_ACCESS;
-    }
-    if (jlistMembership == org_openafs_jafs_Group_GROUP_OWNER_ACCESS) {
-       ptsEntry.listMembership = PTS_GROUP_OWNER_ACCESS;
-    } else if (jlistMembership == org_openafs_jafs_Group_GROUP_GROUP_ACCESS) {
-       ptsEntry.listMembership = PTS_GROUP_ACCESS;
-    } else {
-       ptsEntry.listMembership = PTS_GROUP_ANYUSER_ACCESS;
-    }
-    if (jlistAdd == org_openafs_jafs_Group_GROUP_OWNER_ACCESS) {
-       ptsEntry.listAdd = PTS_GROUP_OWNER_ACCESS;
-    } else if (jlistAdd == org_openafs_jafs_Group_GROUP_GROUP_ACCESS) {
-       ptsEntry.listAdd = PTS_GROUP_ACCESS;
-    } else {
-       ptsEntry.listAdd = PTS_GROUP_ANYUSER_ACCESS;
-    }
-    if (jlistDelete == org_openafs_jafs_Group_GROUP_OWNER_ACCESS) {
-       ptsEntry.listDelete = PTS_GROUP_OWNER_ACCESS;
-    } else if (jlistDelete == org_openafs_jafs_Group_GROUP_GROUP_ACCESS) {
-       ptsEntry.listDelete = PTS_GROUP_ACCESS;
-    } else {
-       ptsEntry.listDelete = PTS_GROUP_ANYUSER_ACCESS;
-    }
-
-    if (!pts_GroupModify((void *)cellHandle, name, &ptsEntry, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(name);
 }
 
 /**
@@ -395,34 +421,39 @@ Java_org_openafs_jafs_Group_setGroupInfo(JNIEnv * env, jclass cls,
  * jname          the name of the group for which to get the members
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Group_getGroupMembersBegin(JNIEnv * env, jclass cls,
-                                                jint cellHandle,
-                                                jstring jname)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Group_getGroupMembersBegin
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname)
 {
-    char *name;
-    afs_status_t ast;
-    void *iterationId;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return 0;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return 0;
+  const char *name;
+  afs_status_t ast;
+  void *iterationId;
+
+  if( jname != NULL ) {
+    name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
+  } else {
+    name = NULL;
+  }
 
-    if (!pts_GroupMemberListBegin
-       ((void *)cellHandle, name, &iterationId, &ast)) {
-       throwAFSException(env, ast);
+  if( !pts_GroupMemberListBegin( (void *) cellHandle, name, &iterationId, 
+                                &ast ) ) {
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
     }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( name != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
 
-    free(name);
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -434,33 +465,32 @@ Java_org_openafs_jafs_Group_getGroupMembersBegin(JNIEnv * env, jclass cls,
  * iterationId   the iteration ID of this iteration
  * returns the name of the next member
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Group_getGroupMembersNextString(JNIEnv * env,
-                                                     jclass cls,
-                                                     jint iterationId)
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Group_getGroupMembersNextString
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
-    char *userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-    jstring juser;
-
-    if (!userName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-
-    if (!pts_GroupMemberListNext((void *)iterationId, userName, &ast)) {
-       free(userName);
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return;
-       }
-    }
-
-    juser = (*env)->NewStringUTF(env, userName);
-    free(userName);
-    return juser;
+  afs_status_t ast;
+  char *userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+  jstring juser;
+
+  if( !userName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( !pts_GroupMemberListNext( (void *) iterationId, userName, &ast ) ) {
+    free( userName );
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
+    }
+  }
+  
+  juser = (*env)->NewStringUTF(env, userName);
+  free( userName );
+  return juser;
 }
 
 /**
@@ -475,46 +505,45 @@ Java_org_openafs_jafs_Group_getGroupMembersNextString(JNIEnv * env,
  *                  next user
  * returns 0 if there are no more users, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Group_getGroupMembersNext(JNIEnv * env, jclass cls,
-                                               jint cellHandle,
-                                               jint iterationId,
-                                               jobject juserObject)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Group_getGroupMembersNext
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong iterationId,
+   jobject juserObject)
 {
-    afs_status_t ast;
-    char *userName;
-    jstring juser;
+  afs_status_t ast;
+  char *userName;
+  jstring juser;
 
-    userName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    if (!userName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
+  if( !userName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
 
-    if (!pts_GroupMemberListNext((void *)iterationId, userName, &ast)) {
-       free(userName);
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
+  if( !pts_GroupMemberListNext( (void *) iterationId, userName, &ast ) ) {
+    free( userName );
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    juser = (*env)->NewStringUTF(env, userName);
+  juser = (*env)->NewStringUTF(env, userName);
 
-    if (userCls == 0) {
-       internal_getUserClass(env, juserObject);
-    }
+  if( userCls == 0 ) {
+    internal_getUserClass( env, juserObject );
+  }
 
-    (*env)->SetObjectField(env, juserObject, user_nameField, juser);
+  (*env)->SetObjectField(env, juserObject, user_nameField, juser);
 
-    getUserInfoChar(env, (void *)cellHandle, userName, juserObject);
-    (*env)->SetBooleanField(env, juserObject, user_cachedInfoField, TRUE);
+  getUserInfoChar( env, (void *) cellHandle, userName, juserObject );
+  (*env)->SetBooleanField( env, juserObject, user_cachedInfoField, TRUE );
 
-    free(userName);
-    return 1;
+  free( userName );
+  return 1;
 
 }
 
@@ -525,16 +554,17 @@ Java_org_openafs_jafs_Group_getGroupMembersNext(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_getGroupMembersDone(JNIEnv * env, jclass cls,
-                                               jint iterationId)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_getGroupMembersDone
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
+  afs_status_t ast;
+
+  if( !pts_GroupMemberListDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!pts_GroupMemberListDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -546,45 +576,55 @@ Java_org_openafs_jafs_Group_getGroupMembersDone(JNIEnv * env, jclass cls,
  * jgroupName          the name of the group to which to add a member
  * juserName      the name of the user to add
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_addMember(JNIEnv * env, jclass cls,
-                                     jint cellHandle, jstring jgroupName,
-                                     jstring juserName)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_addMember
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jgroupName,
+   jstring juserName )
 {
-    afs_status_t ast;
-    char *groupName;
-    char *userName;
-
-    if (jgroupName != NULL) {
-       groupName = getNativeString(env, jgroupName);
-       if (groupName == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
-
-    if (juserName != NULL) {
-       userName = getNativeString(env, juserName);
-       if (userName == NULL) {
-           free(groupName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(groupName);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    if (!pts_GroupMemberAdd((void *)cellHandle, userName, groupName, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(userName);
-    free(groupName);
+  afs_status_t ast;
+  const char *groupName;
+  const char *userName;
+
+  if( jgroupName != NULL ) {
+    groupName = (*env)->GetStringUTFChars(env, jgroupName, 0);
+    if( !groupName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    groupName = NULL;
+  }
+
+  if( juserName != NULL ) {
+    userName = (*env)->GetStringUTFChars(env, juserName, 0);
+    if( !userName ) {
+      if( groupName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    userName = NULL;
+  }
+
+  if( !pts_GroupMemberAdd( (void *) cellHandle, userName, groupName, &ast ) ) {
+    if( groupName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+    }
+    if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( groupName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+  }
+  if( userName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
 }
 
 /**
@@ -597,45 +637,56 @@ Java_org_openafs_jafs_Group_addMember(JNIEnv * env, jclass cls,
  *                           member
  * juserName      the name of the user to remove
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_removeMember(JNIEnv * env, jclass cls,
-                                        jint cellHandle, jstring jgroupName,
-                                        jstring juserName)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_removeMember
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jgroupName,
+   jstring juserName)
 {
-    afs_status_t ast;
-    char *groupName;
-    char *userName;
-
-    if (jgroupName != NULL) {
-       groupName = getNativeString(env, jgroupName);
-       if (groupName == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
-
-    if (juserName != NULL) {
-       userName = getNativeString(env, juserName);
-       if (userName == NULL) {
-           free(groupName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(groupName);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    if (!pts_GroupMemberRemove((void *)cellHandle, userName, groupName, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(groupName);
-    free(userName);
+  afs_status_t ast;
+  const char *groupName;
+  const char *userName;
+
+  if( jgroupName != NULL ) {
+    groupName = (*env)->GetStringUTFChars(env, jgroupName, 0);
+    if( !groupName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    groupName = NULL;
+  }
+
+  if( juserName != NULL ) {
+    userName = (*env)->GetStringUTFChars(env, juserName, 0);
+    if( !userName ) {
+      if( groupName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    userName = NULL;
+  }
+
+  if( !pts_GroupMemberRemove( (void *)cellHandle, userName, 
+                             groupName, &ast ) ) {
+    if( groupName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+    }
+    if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+  
+  if( groupName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+  }
+  if( userName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
 }
 
 /**
@@ -648,45 +699,57 @@ Java_org_openafs_jafs_Group_removeMember(JNIEnv * env, jclass cls,
  *                           owner
  * jownerName      the name of the new owner
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_changeOwner(JNIEnv * env, jclass cls,
-                                       jint cellHandle, jstring jgroupName,
-                                       jstring jownerName)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_changeOwner
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jgroupName,
+   jstring jownerName )
 {
-    afs_status_t ast;
-    char *groupName;
-    char *ownerName;
-
-    if (jgroupName != NULL) {
-       groupName = getNativeString(env, jgroupName);
-       if (groupName == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
-
-    if (jownerName != NULL) {
-       ownerName = getNativeString(env, jownerName);
-       if (ownerName == NULL) {
-           free(groupName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(groupName);
-       throwAFSException(env, JAFSNULLOWNER);
-       return;
-    }
-
-    if (!pts_GroupOwnerChange((void *)cellHandle, groupName, ownerName, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(groupName);
-    free(ownerName);
+  afs_status_t ast;
+  const char *groupName;
+  const char *ownerName;
+
+  if( jgroupName != NULL ) {
+    groupName = (*env)->GetStringUTFChars(env, jgroupName, 0);
+    if( !groupName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    groupName = NULL;
+  }
+
+  if( jownerName != NULL ) {
+    ownerName = (*env)->GetStringUTFChars(env, jownerName, 0);
+    if( !ownerName ) {
+      if( groupName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    ownerName = NULL;
+  }
+
+  if( !pts_GroupOwnerChange( (void *)cellHandle, groupName, 
+                            ownerName, &ast ) ) {
+    if( groupName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+    }
+    if( ownerName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jownerName, ownerName);
+    }
+    throwAFSException( env, ast );
+    return; 
+  }
+
+  if( groupName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jgroupName, groupName);
+  }
+  if( ownerName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jownerName, ownerName);
+  }
+  
 }
 
 /**
@@ -698,54 +761,67 @@ Java_org_openafs_jafs_Group_changeOwner(JNIEnv * env, jclass cls,
  * joldGroupName          the old name of the group
  * jnewGroupName      the new name for the group
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_rename(JNIEnv * env, jclass cls, jint cellHandle,
-                                  jstring jgroupOldName,
-                                  jstring jgroupNewName)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_rename
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jgroupOldName, 
+   jstring jgroupNewName )
 {
-    afs_status_t ast;
-    char *groupOldName;
-    char *groupNewName;
-
-    if (jgroupOldName != NULL) {
-       groupOldName = getNativeString(env, jgroupOldName);
-       if (groupOldName == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
-
-    if (jgroupNewName != NULL) {
-       groupNewName = getNativeString(env, jgroupNewName);
-       if (groupNewName == NULL) {
-           free(groupOldName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(groupOldName);
-       throwAFSException(env, JAFSNULLGROUP);
-       return;
-    }
-
-    if (!pts_GroupRename
-       ((void *)cellHandle, groupOldName, groupNewName, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(groupOldName);
-    free(groupNewName);
+  afs_status_t ast;
+  const char *groupOldName;
+  const char *groupNewName;
+
+  if( jgroupOldName != NULL ) {
+    groupOldName = (*env)->GetStringUTFChars(env, jgroupOldName, 0);
+    if( !groupOldName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    groupOldName = NULL;
+  }
+
+  if( jgroupNewName != NULL ) {
+    groupNewName = (*env)->GetStringUTFChars(env, jgroupNewName, 0);
+    if( !groupNewName ) {
+      if( groupOldName != NULL ) {
+        (*env)->ReleaseStringUTFChars(env, jgroupOldName, groupOldName);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    groupNewName = NULL;
+  }
+
+  if( !pts_GroupRename( (void *)cellHandle, groupOldName, 
+                       groupNewName, &ast ) ) {
+    if( groupOldName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupOldName, groupOldName);
+    }
+    if( groupNewName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jgroupNewName, groupNewName);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( groupOldName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jgroupOldName, groupOldName);
+  }
+  if( groupNewName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jgroupNewName, groupNewName);
+  }
 }
 
 // reclaim global memory used by this portion
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Group_reclaimGroupMemory(JNIEnv * env, jclass cls)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Group_reclaimGroupMemory (JNIEnv *env, jclass cls)
 {
-    if (groupCls) {
-       (*env)->DeleteGlobalRef(env, groupCls);
-       groupCls = 0;
-    }
+  if( groupCls ) {
+      (*env)->DeleteGlobalRef(env, groupCls);
+      groupCls = 0;
+  }
 }
+
+
+
index 9ca0365..5d588d8 100644 (file)
 
 extern int errno;
 
-jmethodID MID_String_getBytes = 0;
-
 #ifndef LIBJUAFS
-/* User Class and Fields */
+// user class and fields //
 jclass userCls = 0;
 jfieldID user_ptsField = 0;
 jfieldID user_kasField = 0;
 jfieldID user_nameField = 0;
+//jfieldID user_cellHandleField = 0;
 jfieldID user_cachedInfoField = 0;
-/* PTS Fields */
+//pts fields
 jfieldID user_nameUidField = 0;
 jfieldID user_ownerUidField = 0;
 jfieldID user_creatorUidField = 0;
@@ -47,7 +46,7 @@ jfieldID user_groupCreationQuotaField = 0;
 jfieldID user_groupMembershipCountField = 0;
 jfieldID user_ownerField = 0;
 jfieldID user_creatorField = 0;
-/* KAS Fields */
+// kas fields
 jfieldID user_adminSettingField = 0;
 jfieldID user_tgsSettingField = 0;
 jfieldID user_encSettingField = 0;
@@ -66,9 +65,10 @@ jfieldID user_failLoginCountField = 0;
 jfieldID user_lockTimeField = 0;
 jfieldID user_lockedUntilField = 0;
 
-/* Group Class and Fields */
+// group class and fields //
 jclass groupCls = 0;
 jfieldID group_nameField = 0;
+//jfieldID group_cellHandleField = 0;
 jfieldID group_cachedInfoField = 0;
 jfieldID group_nameUidField = 0;
 jfieldID group_ownerUidField = 0;
@@ -82,9 +82,10 @@ jfieldID group_membershipCountField = 0;
 jfieldID group_ownerField = 0;
 jfieldID group_creatorField = 0;
 
-/* Server Class and Fields */
+// server class and fields //
 jclass serverCls = 0;
 jfieldID server_nameField = 0;
+//jfieldID server_cellHandleField = 0;
 jfieldID server_cachedInfoField = 0;
 jfieldID server_databaseField = 0;
 jfieldID server_fileServerField = 0;
@@ -92,7 +93,7 @@ jfieldID server_badDatabaseField = 0;
 jfieldID server_badFileServerField = 0;
 jfieldID server_IPAddressField = 0;
 
-/* Executable Time Class and Fields */
+// executable time class and fields //
 jclass exectimeCls = 0;
 jfieldID exectime_HourField = 0;
 jfieldID exectime_MinField = 0;
@@ -101,7 +102,7 @@ jfieldID exectime_DayField = 0;
 jfieldID exectime_NowField = 0;
 jfieldID exectime_NeverField = 0;
 
-/* Partition Class and Fields */
+// partition class and fields //
 jclass partitionCls = 0;
 jfieldID partition_nameField = 0;
 jfieldID partition_cachedInfoField = 0;
@@ -111,7 +112,7 @@ jfieldID partition_lockFileDescriptorField = 0;
 jfieldID partition_totalSpaceField = 0;
 jfieldID partition_totalFreeSpaceField = 0;
 
-/* Volume Class and Fields */
+// volume class and fields //
 jclass volumeCls = 0;
 jfieldID volume_nameField = 0;
 jfieldID volume_cachedInfoField = 0;
@@ -132,7 +133,7 @@ jfieldID volume_statusField = 0;
 jfieldID volume_dispositionField = 0;
 jfieldID volume_typeField = 0;
 
-/* Key Class and Fields */
+// key class and fields //
 jclass keyCls = 0;
 jfieldID key_cachedInfoField = 0;
 jfieldID key_versionField = 0;
@@ -141,10 +142,11 @@ jfieldID key_lastModDateField = 0;
 jfieldID key_lastModMsField = 0;
 jfieldID key_checkSumField = 0;
 
-/* Process Class and Fields */
+// process class and fields //
 jclass processCls = 0;
 jfieldID process_cachedInfoField = 0;
 jfieldID process_nameField = 0;
+//jfieldID process_serverHandleField = 0;
 jfieldID process_typeField = 0;
 jfieldID process_stateField = 0;
 jfieldID process_goalField = 0;
@@ -157,7 +159,6 @@ jfieldID process_errorSignalField = 0;
 jfieldID process_stateOkField = 0;
 jfieldID process_stateTooManyErrorsField = 0;
 jfieldID process_stateBadFileAccessField = 0;
-
 #endif /* !LIBJUAFS */
 
 /**
@@ -165,37 +166,31 @@ jfieldID process_stateBadFileAccessField = 0;
  * for the exception.  See Exceptions.h for the available
  * exceptions.
  */
-void
-throwException(JNIEnv * env, jclass * excCls, char *excClsName,
-              jmethodID * initID, int code)
+void throwException
+  (JNIEnv *env, jclass *excCls, char *excClsName, jmethodID *initID, int code)
 {
-    jobject exc;
-    if (*excCls == 0) {
-       *excCls =
-           (*env)->NewGlobalRef(env, (*env)->FindClass(env, excClsName));
-       if (!*excCls) {
-           fprintf(stderr,
-                   "ERROR: Internal::throwException()\n Cannot find class: %s\n",
-                   excClsName);
-           return;
-       }
-       *initID = (*env)->GetMethodID(env, *excCls, "<init>", "(I)V");
-       if (!*initID) {
-           fprintf(stderr,
-                   "ERROR: Internal::throwException()\n Cannot find construction method: %s\n",
-                   excClsName);
-           return;
-       }
+  jobject exc;
+  if( *excCls == 0 ) {
+    *excCls = (*env)->NewGlobalRef(env, (*env)->FindClass(env, excClsName ));
+    if( !*excCls ) {
+      fprintf(stderr, "ERROR: Internal::throwException()\n Cannot find class: %s\n", excClsName);
+       return;
     }
-
-    exc = (*env)->NewObject(env, *excCls, *initID, code);
-    if (!exc) {
-       fprintf(stderr,
-               "ERROR: Internal::throwException()\n Cannot construct new exception object: %s\n",
-               excClsName);
+    *initID = (*env)->GetMethodID( env, *excCls, "<init>", "(I)V" );
+    if( !*initID ) {
+      fprintf(stderr, "ERROR: Internal::throwException()\n Cannot find construction method: %s\n",
+             excClsName);
        return;
     }
-    (*env)->Throw(env, exc);
+  }
+  
+  exc = (*env)->NewObject( env, *excCls, *initID, code );
+  if( !exc ) {
+    fprintf(stderr, "ERROR: Internal::throwException()\n Cannot construct new exception object: %s\n",
+                     excClsName);
+    return;
+  }
+  (*env)->Throw(env, exc);
 }
 
 /**
@@ -204,17 +199,14 @@ throwException(JNIEnv * env, jclass * excCls, char *excClsName,
  * is unavailable and it is necessary to interrupt the Java call with an
  * exception. See Exceptions.h for the available exceptions.
  */
-void
-throwMessageException(JNIEnv * env, char *msg)
+void throwMessageException( JNIEnv *env, char *msg )
 {
-    jclass excCls = (*env)->FindClass(env, afsExceptionName);
-    if (excCls == 0) {
-       fprintf(stderr,
-               "ERROR: Internal::throwMessageException()\n Cannot find class: %s\n",
-               afsExceptionName);
-       return;
-    }
-    (*env)->ThrowNew(env, excCls, msg);
+  jclass excCls = (*env)->FindClass(env, afsExceptionName);
+  if(excCls == 0) {
+    fprintf(stderr, "ERROR: Internal::throwMessageException()\n Cannot find class: %s\n", afsExceptionName);
+    return;
+  }
+  (*env)->ThrowNew(env, excCls, msg);
 }
 
 /**
@@ -222,39 +214,34 @@ throwMessageException(JNIEnv * env, char *msg)
  * for the exception.  See Exceptions.h for the available
  * exceptions.
  */
-void
-throwAFSException(JNIEnv * env, int code)
+void throwAFSException( JNIEnv *env, int code )
 {
-    jclass afsExceptionCls;
-    jmethodID afsExceptionInit;
-    jthrowable exc;
-
-    afsExceptionCls = (*env)->FindClass(env, afsExceptionName);
-    if (!afsExceptionCls) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSException()\n Cannot find class: %s\n",
-               afsExceptionName);
-       return;
-    }
-
-    afsExceptionInit =
-       (*env)->GetMethodID(env, afsExceptionCls, "<init>", "(I)V");
-    if (!afsExceptionInit) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSException()\n Cannot find construction method: %s\n",
-               afsExceptionName);
-       return;
-    }
-
-    exc = (*env)->NewObject(env, afsExceptionCls, afsExceptionInit, code);
-
-    if (!exc) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSException()\n Cannot construct new exception object: %s\n",
-               afsExceptionName);
-       return;
-    }
-    (*env)->Throw(env, exc);
+  jclass afsExceptionCls;
+  jmethodID afsExceptionInit;
+  jthrowable exc;
+
+  afsExceptionCls = (*env)->FindClass(env, afsExceptionName);
+  if( !afsExceptionCls ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSException()\n Cannot find class: %s\n", afsExceptionName);
+    return;
+  }
+
+  afsExceptionInit = (*env)->GetMethodID( env, afsExceptionCls, 
+                             "<init>", "(I)V" );
+  if( !afsExceptionInit ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSException()\n Cannot find construction method: %s\n",
+                     afsExceptionName);
+    return;
+  }
+  
+  exc = (*env)->NewObject( env, afsExceptionCls, afsExceptionInit, code );
+
+  if( !exc ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSException()\n Cannot construct new exception object: %s\n",
+                     afsExceptionName);
+    return;
+  }
+  (*env)->Throw(env, exc);
 }
 
 /**
@@ -262,42 +249,34 @@ throwAFSException(JNIEnv * env, int code)
  * for the exception.  See Exceptions.h for the available
  * exceptions.
  */
-void
-throwAFSFileException(JNIEnv * env, int code, char *msg)
+void throwAFSFileException( JNIEnv *env, int code, char *msg )
 {
-    jclass afsFileExceptionCls;
-    jmethodID afsFileExceptionInit;
-    jthrowable exc;
-
-    afsFileExceptionCls = (*env)->FindClass(env, afsFileExceptionName);
-    if (!afsFileExceptionCls) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSFileException()\n Cannot find class: %s\n",
-               afsFileExceptionName);
-       return;
-    }
-
-    afsFileExceptionInit =
-       (*env)->GetMethodID(env, afsFileExceptionCls, "<init>",
-                           "(Ljava/lang/String;I)V");
-
-    if (!afsFileExceptionInit) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSFileException()\n Cannot find construction method: %s\n",
-               afsFileExceptionName);
-       return;
-    }
-
-    exc =
-       (*env)->NewObject(env, afsFileExceptionCls, afsFileExceptionInit, msg,
-                         code);
-    if (!exc) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSFileException()\n Cannot construct new exception object: %s\n",
-               afsFileExceptionName);
-       return;
-    }
-    (*env)->Throw(env, exc);
+  jclass afsFileExceptionCls;
+  jmethodID afsFileExceptionInit;
+  jthrowable exc;
+
+  afsFileExceptionCls = (*env)->FindClass(env, afsFileExceptionName);
+  if( !afsFileExceptionCls ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSFileException()\n Cannot find class: %s\n", afsFileExceptionName);
+    return;
+  }
+
+  afsFileExceptionInit = (*env)->GetMethodID( env, afsFileExceptionCls, 
+                         "<init>", "(Ljava/lang/String;I)V" );
+  if( !afsFileExceptionInit ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSFileException()\n Cannot find construction method: %s\n",
+                     afsFileExceptionName);
+    return;
+  }
+  
+  exc = (*env)->NewObject( env, afsFileExceptionCls,
+                           afsFileExceptionInit, msg, code );
+  if( !exc ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSFileException()\n Cannot construct new exception object: %s\n",
+                     afsFileExceptionName);
+    return;
+  }
+  (*env)->Throw(env, exc);
 }
 
 /**
@@ -305,156 +284,49 @@ throwAFSFileException(JNIEnv * env, int code, char *msg)
  * for the exception.  See Exceptions.h for the available
  * exceptions.
  */
-void
-throwAFSSecurityException(JNIEnv * env, int code)
-{
-    jclass afsSecurityExceptionCls;
-    jmethodID afsSecurityExceptionInit;
-    jthrowable exc;
-
-    afsSecurityExceptionCls =
-       (*env)->FindClass(env, afsSecurityExceptionName);
-    if (!afsSecurityExceptionCls) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSSecurityException()\n Cannot find class: %s\n",
-               afsSecurityExceptionName);
-       return;
-    }
-
-    afsSecurityExceptionInit =
-       (*env)->GetMethodID(env, afsSecurityExceptionCls, "<init>", "(I)V");
-    if (!afsSecurityExceptionInit) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSSecurityException()\n Cannot find construction method: %s\n",
-               afsSecurityExceptionName);
-       return;
-    }
-
-    exc =
-       (*env)->NewObject(env, afsSecurityExceptionCls,
-                         afsSecurityExceptionInit, code);
-
-    if (!exc) {
-       fprintf(stderr,
-               "ERROR: Internal::throwAFSSecurityException()\n Cannot construct new exception object: %s\n",
-               afsSecurityExceptionName);
-       return;
-    }
-    (*env)->Throw(env, exc);
-}
-
-int
-setError(JNIEnv * env, jobject * obj, int code)
+void throwAFSSecurityException( JNIEnv *env, int code )
 {
-    jfieldID fid;
-    jclass cls = (*env)->GetObjectClass(env, *obj);
-    if (cls != NULL) {
-       fid = (*env)->GetFieldID(env, cls, "errno", "I");
-       if (fid) {
-           (*env)->SetIntField(env, *obj, fid, code);
-           return 0;
-       }
-    }
-    return -1;
+  jclass afsSecurityExceptionCls;
+  jmethodID afsSecurityExceptionInit;
+  jthrowable exc;
+
+  afsSecurityExceptionCls = (*env)->FindClass(env, afsSecurityExceptionName);
+  if( !afsSecurityExceptionCls ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSSecurityException()\n Cannot find class: %s\n", afsSecurityExceptionName);
+    return;
+  }
+
+  afsSecurityExceptionInit = (*env)->GetMethodID( env, afsSecurityExceptionCls, 
+                             "<init>", "(I)V" );
+  if( !afsSecurityExceptionInit ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSSecurityException()\n Cannot find construction method: %s\n",
+                     afsSecurityExceptionName);
+    return;
+  }
+  
+  exc = (*env)->NewObject( env, afsSecurityExceptionCls,
+                           afsSecurityExceptionInit, code );
+  if( !exc ) {
+    fprintf(stderr, "ERROR: Internal::throwAFSSecurityException()\n Cannot construct new exception object: %s\n",
+                     afsSecurityExceptionName);
+    return;
+  }
+  (*env)->Throw(env, exc);
 }
 
-int
-setString(JNIEnv * env, jobject * obj, char *field, char *string)
+int setError(JNIEnv *env, jobject *obj, int code)
 {
-    jclass cls;
-    jstring jstr;
-    jfieldID fid;
-
-    cls = (*env)->GetObjectClass(env, *obj);
-    /*fprintf(stderr, "setString: env=0x%x, obj=0x%x, cls=0x%x\n", env, obj, cls); */
-    if (cls != NULL) {
-       fid = (*env)->GetFieldID(env, cls, field, "Ljava/lang/String;");
-       /*fprintf(stderr, "setString: field=%s, fid=0x%x\n", field, fid); */
-       if (fid) {
-           jstr = (*env)->NewStringUTF(env, (string));
-           /*fprintf(stderr, "jstr = 0x%x\n", jstr); */
-           (*env)->SetObjectField(env, *obj, fid, jstr);
-           return 0;
-       }
-    }
-    return -1;
-}
-
-/**
- * Translates a jstring to a locale-specific native C string.
- * Use in place of "GetStringUTFChars()" for internationalization
- * purposes.
- * 
- * Make sure to "free()" any strings created by this function.
- *
- * A NULL (zero) return indicates a critical error has occurred and 
- * relies on the caller of this function to throw a Java exception.
- *
- * This function does not throw any Java exceptions.
- * 
- *  env         the Java environment
- *  jstr        the Java string (UTF) to translate
- *
- * @returns        native C string with the appropriate locale-specific 
- *              representation
- */
-char *
-getNativeString(JNIEnv * env, const jstring jstr)
-{
-    jbyteArray bytes = 0;
-    char *result = NULL;
-    jint len = 0;
-
-    if ((*env)->EnsureLocalCapacity(env, 2) < 0) {
-       // Out of memory error
-       fprintf(stderr, "Internal::getNativeString(): ");
-       fprintf(stderr,
-               "EnsureLocalCapacity() failed: Most likely out of memory\n");
-       return NULL;
-    }
-
-    if (!MID_String_getBytes) {
-       jclass stringClass = (*env)->FindClass(env, "java/lang/String");
-       if (!stringClass) {
-           fprintf(stderr, "Internal::getNativeString(): ");
-           fprintf(stderr,
-                   "Could not locate Java class: java.lang.String.\n");
-           return NULL;
-       }
-
-       MID_String_getBytes =
-           (*env)->GetMethodID(env, stringClass, "getBytes", "()[B");
-       if (!MID_String_getBytes) {
-           fprintf(stderr, "Internal::getNativeString(): ");
-           fprintf(stderr,
-                   "Could not get Java method id for java.lang.String method \"getBytes()\".\n");
-           return NULL;
-       }
-    }
-
-    bytes = (*env)->CallObjectMethod(env, jstr, MID_String_getBytes);
-    if (!bytes) {
-       fprintf(stderr, "Internal::getNativeString(): ");
-       fprintf(stderr,
-               "CallObjectMethod() failed for java.lang.String.getBytes().\n");
-       fprintf(stderr, "\tMID_String_getBytes = %d\n", MID_String_getBytes);
-       return NULL;
-    }
-
-    len = (*env)->GetArrayLength(env, bytes);
-    result = (char *)malloc(len + 1);
-
-    if (!result) {
-       fprintf(stderr, "Internal::getNativeString(): ");
-       fprintf(stderr, "Could not allocate memory for byte array.\n");
-       (*env)->DeleteLocalRef(env, bytes);
-       return NULL;
-    }
-    (*env)->GetByteArrayRegion(env, bytes, 0, len, (jbyte *) result);
-    result[len] = '\0';                // NULL-terminate
-
-    (*env)->DeleteLocalRef(env, bytes);
-    return result;
+  jfieldID fid;
+  jclass cls = (*env)->GetObjectClass(env, *obj);
+  if (cls != NULL) {
+    fid = (*env)->GetFieldID(env, cls, "errno", "I");
+    if (fid)
+    {
+      (*env)->SetIntField(env, *obj, fid, code);
+      return 0;
+    }
+  }
+  return -1;
 }
 
 #ifdef LIBJUAFS
@@ -471,121 +343,124 @@ getNativeString(JNIEnv * env, const jstring jstr)
  *
  * @returns            file descriptor
  */
-int
-openAFSFile(JNIEnv * env, jstring filenameUTF, int flags, int mode, int *err)
+int openAFSFile
+  (JNIEnv *env, jstring fileNameUTF, int flags, int mode, int *err)
 {
-    char *filename;
+    char *fileName;
     int fd = -1;
 
     *err = 0;
     errno = 0;
-    filename = getNativeString(env, filenameUTF);
-    if (filename == NULL) {
-       fprintf(stderr, "Internal::openAFSFile(): failed to get filename\n");
-       *err = -1;
-       return fd;
+    fileName=(char*) (*env)->GetStringUTFChars(env, fileNameUTF, 0);
+    if(fileName == NULL) {
+      fprintf(stderr, "Internal::openAFSFile(): failed to get fileName\n");
+      *err = -1;
+      return fd;
     }
-    fd = uafs_open(filename, flags, mode);
-    free(filename);
+    fd  = uafs_open(fileName, flags, mode);
     *err = errno;
     if (errno != 0) {
-       fprintf(stderr, "Internal::openAFSFile(): errno=%d\n", errno);
-       fprintf(stderr, "Internal::openAFSFile(): fd=%d\n", fd);
+      fprintf(stderr, "Internal::openAFSFile(): errno=%d\n", errno);
+      fprintf(stderr, "Internal::openAFSFile(): fd=%d\n", fd);
     }
+    (*env)->ReleaseStringUTFChars(env, fileNameUTF, fileName);
     if (fd < 0) {
-       fprintf(stderr, "Internal::openAFSFile(): failed to open filename\n");
-       fprintf(stderr, "Internal::openAFSFile(): fd=%d\n", fd);
-       return -1;
+      fprintf(stderr, "Internal::openAFSFile(): failed to open fileName\n");
+      fprintf(stderr, "Internal::openAFSFile(): fd=%d\n", fd);
+      return -1;
     }
     return fd;
 }
 
-/**
- * Reads the "CacheConfig" file for user space configuration.
- * By default, this file resides in "/usr/afswsp/etc/CacheConfig",
- * however if the environment variable "LIBJAFS_CACHE_CONFIG" is
- * set this function will use that value instead.
- *
- * The CacheConfig file contains several cache tuning parameters 
- * as well as a few parameters that define the runtime environment 
- * for the user space client, including: mount point location, 
- * configuration directory (where to find ThisCell and CellServDB), 
- * cache directory, debug and verbose options, and log file location.
- */
-int
-readCacheParms(char *afsMountPoint, char *afsConfDir, char *afsCacheDir,
-              int *cacheBlocks, int *cacheFiles, int *cacheStatEntries,
-              int *dCacheSize, int *vCacheSize, int *chunkSize,
-              int *closeSynch, int *debug, int *nDaemons, int *cacheFlags,
-              char *logFile)
+int readCacheParms(char *afsMountPoint, char *afsConfDir, char *afsCacheDir,
+                   int *cacheBlocks, int *cacheFiles, int *cacheStatEntries,
+                   int *dCacheSize, int *vCacheSize, int *chunkSize,
+                   int *closeSynch, int *debug, int *nDaemons, int *cacheFlags,
+                   char *logFile)
 {
-    FILE *f;
-    char line[100];
-    char *p;
-    int len1, len2, n;
-    char cacheConfigFile[100];
-
-    p = (char *)getenv("LIBJAFS_CACHE_CONFIG");
-    if (p) {
-       strcpy(cacheConfigFile, p);
-    } else {
-       strcpy(cacheConfigFile, "/usr/afswsp/etc/CacheConfig");
-    }
-
-    f = fopen(cacheConfigFile, "r");
-    if (!f) {
-       fprintf(stderr, "Could not open cache config file: %s\n",
-               cacheConfigFile);
-       return -1;
-    }
+  FILE *f;
+  char line[100];
+  char *p;
+  int len1, len2, n;
+  char cacheConfigFile[100];
+  
+  p = (char *)getenv("LIBJAFS_CACHE_CONFIG");
+  if (p) {
+    strcpy(cacheConfigFile, p);
+  } else {
+    strcpy(cacheConfigFile, "/usr/afswsp/etc/CacheConfig");
+  }
+
+  f = fopen(cacheConfigFile, "r");
+  if (!f) {
+    fprintf(stderr, "Could not open cache config file: %s\n",
+            cacheConfigFile);
+    return -1;
+  }
+
+  while (1) {
+    fgets(line, 100, f);
+    if (feof(f)) break;
+    p = (char *)strchr(line, '\n');
+    if (p) *p = '\0';
+    if (strncmp(line, "#", 1) == 0) continue;  /* comment */
+
+    p = (char *)strchr(line, ' ');
+    if (!p) continue;
+    len1 = p - line;
+    p++; len2 = strlen(p);
+
+    if (strncmp(line, "MountPoint", len1) == 0)
+       strcpy(afsMountPoint, p);
+    else if (strncmp(line, "ConfDir", len1) == 0)
+       strcpy(afsConfDir, p);
+    else if (strncmp(line, "CacheDir", len1) == 0)
+       strcpy(afsCacheDir, p);
+    else if (strncmp(line, "CacheBlocks", len1) == 0)
+       *cacheBlocks = atoi(p);
+    else if (strncmp(line, "CacheFiles", len1) == 0)
+       *cacheFiles = atoi(p);
+    else if (strncmp(line, "CacheStatEntries", len1) == 0)
+       *cacheStatEntries = atoi(p);
+    else if (strncmp(line, "DCacheSize", len1) == 0)
+       *dCacheSize = atoi(p);
+    else if (strncmp(line, "VCacheSize", len1) == 0)
+       *vCacheSize = atoi(p);
+    else if (strncmp(line, "ChunkSize", len1) == 0)
+       *chunkSize = atoi(p);
+    else if (strncmp(line, "CloseSynch", len1) == 0)
+       *closeSynch = atoi(p);
+    else if (strncmp(line, "Debug", len1) == 0)
+       *debug = atoi(p);
+    else if (strncmp(line, "NDaemons", len1) == 0)
+       *nDaemons = atoi(p);
+    else if (strncmp(line, "CacheFlags", len1) == 0)
+       *cacheFlags = atoi(p);
+    else if (strncmp(line, "LogFile", len1) == 0)
+       strcpy(logFile, p);
+  }
+  return 0;
+}
 
-    while (1) {
-       fgets(line, 100, f);
-       if (feof(f))
-           break;
-       p = (char *)strchr(line, '\n');
-       if (p)
-           *p = '\0';
-       if (strncmp(line, "#", 1) == 0)
-           continue;           /* comment */
-
-       p = (char *)strchr(line, ' ');
-       if (!p)
-           continue;
-       len1 = p - line;
-       p++;
-       len2 = strlen(p);
-
-       if (strncmp(line, "MountPoint", len1) == 0)
-           strcpy(afsMountPoint, p);
-       else if (strncmp(line, "ConfDir", len1) == 0)
-           strcpy(afsConfDir, p);
-       else if (strncmp(line, "CacheDir", len1) == 0)
-           strcpy(afsCacheDir, p);
-       else if (strncmp(line, "CacheBlocks", len1) == 0)
-           *cacheBlocks = atoi(p);
-       else if (strncmp(line, "CacheFiles", len1) == 0)
-           *cacheFiles = atoi(p);
-       else if (strncmp(line, "CacheStatEntries", len1) == 0)
-           *cacheStatEntries = atoi(p);
-       else if (strncmp(line, "DCacheSize", len1) == 0)
-           *dCacheSize = atoi(p);
-       else if (strncmp(line, "VCacheSize", len1) == 0)
-           *vCacheSize = atoi(p);
-       else if (strncmp(line, "ChunkSize", len1) == 0)
-           *chunkSize = atoi(p);
-       else if (strncmp(line, "CloseSynch", len1) == 0)
-           *closeSynch = atoi(p);
-       else if (strncmp(line, "Debug", len1) == 0)
-           *debug = atoi(p);
-       else if (strncmp(line, "NDaemons", len1) == 0)
-           *nDaemons = atoi(p);
-       else if (strncmp(line, "CacheFlags", len1) == 0)
-           *cacheFlags = atoi(p);
-       else if (strncmp(line, "LogFile", len1) == 0)
-           strcpy(logFile, p);
-    }
-    return 0;
+int setString(JNIEnv *env, jobject *obj, char *field, char *string)
+{
+  jclass cls;
+  jstring jstr;
+  jfieldID fid;
+
+  cls = (*env)->GetObjectClass(env, *obj);
+  /*fprintf(stderr, "setString: env=0x%x, obj=0x%x, cls=0x%x\n", env, obj, cls);*/
+  if (cls != NULL) {
+    fid = (*env)->GetFieldID(env, cls, field, "Ljava/lang/String;");
+    /*fprintf(stderr, "setString: field=%s, fid=0x%x\n", field, fid);*/
+    if (fid) {
+      jstr = (*env)->NewStringUTF(env, (string));
+      /*fprintf(stderr, "jstr = 0x%x\n", jstr);*/
+      (*env)->SetObjectField(env, *obj, fid, jstr);
+      return 0;
+    }
+  }
+  return -1;
 }
 
 #else
@@ -597,214 +472,204 @@ readCacheParms(char *afsMountPoint, char *afsConfDir, char *afsCacheDir,
  * the instance is the empty string.  The memory for who 
  * that's passed in should be fully allocated in advance.
  */
-void
-internal_makeKasIdentity(const char *fullName, kas_identity_p who)
-{
-    char *period;
-
-    if ((period = (char *)strchr(fullName, '.')) != NULL) {
-       strncpy(who->principal, fullName, period - fullName);
-       who->principal[period - fullName] = '\0';
-       strncpy(who->instance, period + 1,
-               strlen(fullName) - (period - fullName));
-    } else {
-       strcpy(who->principal, fullName);
-       strcpy(who->instance, "");
-    }
+void internal_makeKasIdentity( const char *fullName, 
+                                      kas_identity_p who ) {
+
+  char *period;
+
+  if( (period = (char *) strchr( fullName, '.' )) != NULL ) {
+    strncpy( who->principal, fullName, period - fullName );
+    who->principal[period - fullName] = '\0';
+    strncpy( who->instance, period + 1, 
+            strlen(fullName) - (period - fullName) );
+  } else {
+    strcpy( who->principal, fullName);
+    strcpy( who->instance, "" );
+  }
+
 }
 
 /**
  * Given a Java environment and an instance of a user, gets the object and
  * field information for the user object from the Java environment.
  */
-void
-internal_getUserClass(JNIEnv * env, jobject user)
-{
-    if (userCls == 0) {
-       userCls =
-           (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, user));
-       if (!userCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       user_ptsField = (*env)->GetFieldID(env, userCls, "pts", "Z");
-       user_kasField = (*env)->GetFieldID(env, userCls, "kas", "Z");
-       user_nameField =
-           (*env)->GetFieldID(env, userCls, "name", "Ljava/lang/String;");
-       user_cachedInfoField =
-           (*env)->GetFieldID(env, userCls, "cachedInfo", "Z");
-       // pts fields
-       user_nameUidField = (*env)->GetFieldID(env, userCls, "nameUID", "I");
-       user_ownerUidField =
-           (*env)->GetFieldID(env, userCls, "ownerUID", "I");
-       user_creatorUidField =
-           (*env)->GetFieldID(env, userCls, "creatorUID", "I");
-       user_listStatusField =
-           (*env)->GetFieldID(env, userCls, "listStatus", "I");
-       user_listGroupsOwnedField =
-           (*env)->GetFieldID(env, userCls, "listGroupsOwned", "I");
-       user_listMembershipField =
-           (*env)->GetFieldID(env, userCls, "listMembership", "I");
-       user_groupCreationQuotaField =
-           (*env)->GetFieldID(env, userCls, "groupCreationQuota", "I");
-       user_groupMembershipCountField =
-           (*env)->GetFieldID(env, userCls, "groupMembershipCount", "I");
-       user_ownerField =
-           (*env)->GetFieldID(env, userCls, "owner", "Ljava/lang/String;");
-       user_creatorField =
-           (*env)->GetFieldID(env, userCls, "creator", "Ljava/lang/String;");
-       // kas fields
-       user_adminSettingField =
-           (*env)->GetFieldID(env, userCls, "adminSetting", "I");
-       user_tgsSettingField =
-           (*env)->GetFieldID(env, userCls, "tgsSetting", "I");
-       user_encSettingField =
-           (*env)->GetFieldID(env, userCls, "encSetting", "I");
-       user_cpwSettingField =
-           (*env)->GetFieldID(env, userCls, "cpwSetting", "I");
-       user_rpwSettingField =
-           (*env)->GetFieldID(env, userCls, "rpwSetting", "I");
-       user_userExpirationField =
-           (*env)->GetFieldID(env, userCls, "userExpiration", "I");
-       user_lastModTimeField =
-           (*env)->GetFieldID(env, userCls, "lastModTime", "I");
-       user_lastModNameField =
-           (*env)->GetFieldID(env, userCls, "lastModName",
-                              "Ljava/lang/String;");
-       user_lastChangePasswordTimeField =
-           (*env)->GetFieldID(env, userCls, "lastChangePasswordTime", "I");
-       user_maxTicketLifetimeField =
-           (*env)->GetFieldID(env, userCls, "maxTicketLifetime", "I");
-       user_keyVersionField =
-           (*env)->GetFieldID(env, userCls, "keyVersion", "I");
-       user_encryptionKeyField =
-           (*env)->GetFieldID(env, userCls, "encryptionKey",
-                              "Ljava/lang/String;");
-       user_keyCheckSumField =
-           (*env)->GetFieldID(env, userCls, "keyCheckSum", "J");
-       user_daysToPasswordExpireField =
-           (*env)->GetFieldID(env, userCls, "daysToPasswordExpire", "I");
-       user_failLoginCountField =
-           (*env)->GetFieldID(env, userCls, "failLoginCount", "I");
-       user_lockTimeField =
-           (*env)->GetFieldID(env, userCls, "lockTime", "I");
-       user_lockedUntilField =
-           (*env)->GetFieldID(env, userCls, "lockedUntil", "I");
-       if (!user_ptsField || !user_kasField || !user_nameField
-           || !user_cachedInfoField || !user_nameUidField
-           || !user_ownerUidField || !user_creatorUidField
-           || !user_listStatusField || !user_listGroupsOwnedField
-           || !user_listMembershipField || !user_groupCreationQuotaField
-           || !user_groupMembershipCountField || !user_ownerField
-           || !user_creatorField || !user_adminSettingField
-           || !user_tgsSettingField || !user_encSettingField
-           || !user_cpwSettingField || !user_rpwSettingField
-           || !user_userExpirationField || !user_lastModTimeField
-           || !user_lastModNameField || !user_lastChangePasswordTimeField
-           || !user_maxTicketLifetimeField || !user_keyVersionField
-           || !user_encryptionKeyField || !user_keyCheckSumField
-           || !user_daysToPasswordExpireField || !user_failLoginCountField
-           || !user_lockTimeField || !user_lockedUntilField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-       }
+void internal_getUserClass( JNIEnv *env, jobject user ) {
+  if( userCls == 0 ) {
+    userCls = (*env)->NewGlobalRef( env, (*env)->GetObjectClass(env, user) );
+    if( !userCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
     }
+    user_ptsField = (*env)->GetFieldID( env, userCls, "pts", "Z" );
+    user_kasField = (*env)->GetFieldID( env, userCls, "kas", "Z" );
+    user_nameField = (*env)->GetFieldID( env, userCls, "name", 
+                                        "Ljava/lang/String;" );
+    user_cachedInfoField = (*env)->GetFieldID( env, userCls, "cachedInfo", 
+                                              "Z" );
+    // pts fields
+    user_nameUidField = (*env)->GetFieldID( env, userCls, "nameUID", "I" );
+    user_ownerUidField = (*env)->GetFieldID( env, userCls, "ownerUID", "I" );
+    user_creatorUidField = (*env)->GetFieldID( env, userCls, "creatorUID", 
+                                              "I" );
+    user_listStatusField = (*env)->GetFieldID( env, userCls, "listStatus", 
+                                              "I" );
+    user_listGroupsOwnedField = (*env)->GetFieldID( env, userCls, 
+                                                   "listGroupsOwned", "I" );
+    user_listMembershipField = (*env)->GetFieldID( env, userCls, 
+                                                  "listMembership", "I" );
+    user_groupCreationQuotaField = (*env)->GetFieldID( env, userCls, 
+                                                      "groupCreationQuota", 
+                                                      "I" );
+    user_groupMembershipCountField = (*env)->GetFieldID( env, userCls, 
+                                                       "groupMembershipCount",
+                                                        "I" );
+    user_ownerField = (*env)->GetFieldID( env, userCls, "owner", 
+                                         "Ljava/lang/String;" );
+    user_creatorField = (*env)->GetFieldID( env, userCls, "creator", 
+                                           "Ljava/lang/String;" );
+    // kas fields
+    user_adminSettingField = (*env)->GetFieldID( env, userCls, "adminSetting",
+                                                "I" );
+    user_tgsSettingField = (*env)->GetFieldID( env, userCls, "tgsSetting", 
+                                              "I" );
+    user_encSettingField = (*env)->GetFieldID( env, userCls, "encSetting", 
+                                              "I" );
+    user_cpwSettingField = (*env)->GetFieldID( env, userCls, "cpwSetting", 
+                                              "I" );
+    user_rpwSettingField = (*env)->GetFieldID( env, userCls, "rpwSetting", 
+                                              "I" );
+    user_userExpirationField = (*env)->GetFieldID( env, userCls, 
+                                                  "userExpiration", "I" );
+    user_lastModTimeField = (*env)->GetFieldID( env, userCls, "lastModTime", 
+                                               "I" );
+    user_lastModNameField = (*env)->GetFieldID( env, userCls, "lastModName", 
+                                               "Ljava/lang/String;" );
+    user_lastChangePasswordTimeField = (*env)->GetFieldID( env, userCls, 
+                                                     "lastChangePasswordTime",
+                                                          "I" );
+    user_maxTicketLifetimeField = (*env)->GetFieldID( env, userCls, 
+                                                     "maxTicketLifetime", 
+                                                     "I" );
+    user_keyVersionField = (*env)->GetFieldID( env, userCls, "keyVersion", 
+                                              "I" );
+    user_encryptionKeyField = (*env)->GetFieldID( env, userCls, 
+                                                 "encryptionKey", 
+                                                 "Ljava/lang/String;" );
+    user_keyCheckSumField = (*env)->GetFieldID( env, userCls, "keyCheckSum", 
+                                               "J" );
+    user_daysToPasswordExpireField = (*env)->GetFieldID( env, userCls, 
+                                                       "daysToPasswordExpire",
+                                                        "I" );
+    user_failLoginCountField = (*env)->GetFieldID( env, userCls, 
+                                                  "failLoginCount", "I" );
+    user_lockTimeField = (*env)->GetFieldID( env, userCls, "lockTime", "I" );
+    user_lockedUntilField = (*env)->GetFieldID( env, userCls, "lockedUntil", 
+                                               "I" );
+    if( !user_ptsField || !user_kasField || !user_nameField || 
+       !user_cachedInfoField || !user_nameUidField || !user_ownerUidField || 
+       !user_creatorUidField || !user_listStatusField || 
+       !user_listGroupsOwnedField || !user_listMembershipField || 
+       !user_groupCreationQuotaField || !user_groupMembershipCountField || 
+       !user_ownerField || !user_creatorField || !user_adminSettingField || 
+       !user_tgsSettingField || !user_encSettingField || 
+       !user_cpwSettingField || !user_rpwSettingField || 
+       !user_userExpirationField || !user_lastModTimeField || 
+       !user_lastModNameField || !user_lastChangePasswordTimeField || 
+       !user_maxTicketLifetimeField || !user_keyVersionField || 
+       !user_encryptionKeyField || !user_keyCheckSumField || 
+       !user_daysToPasswordExpireField || !user_failLoginCountField || 
+       !user_lockTimeField || !user_lockedUntilField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
+    }
+  } 
 }
 
 /**
  * Given a Java environment and an instance of a group, gets the object and
  * field information for the group object from the Java environment.
  */
-void
-internal_getGroupClass(JNIEnv * env, jobject group)
-{
-    if (groupCls == 0) {
-       groupCls =
-           (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, group));
-       if (!groupCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       group_nameField =
-           (*env)->GetFieldID(env, groupCls, "name", "Ljava/lang/String;");
-       group_cachedInfoField =
-           (*env)->GetFieldID(env, groupCls, "cachedInfo", "Z");
-       group_nameUidField =
-           (*env)->GetFieldID(env, groupCls, "nameUID", "I");
-       group_ownerUidField =
-           (*env)->GetFieldID(env, groupCls, "ownerUID", "I");
-       group_creatorUidField =
-           (*env)->GetFieldID(env, groupCls, "creatorUID", "I");
-       group_listStatusField =
-           (*env)->GetFieldID(env, groupCls, "listStatus", "I");
-       group_listGroupsOwnedField =
-           (*env)->GetFieldID(env, groupCls, "listGroupsOwned", "I");
-       group_listMembershipField =
-           (*env)->GetFieldID(env, groupCls, "listMembership", "I");
-       group_listAddField =
-           (*env)->GetFieldID(env, groupCls, "listAdd", "I");
-       group_listDeleteField =
-           (*env)->GetFieldID(env, groupCls, "listDelete", "I");
-       group_membershipCountField =
-           (*env)->GetFieldID(env, groupCls, "membershipCount", "I");
-       group_ownerField =
-           (*env)->GetFieldID(env, groupCls, "owner", "Ljava/lang/String;");
-       group_creatorField =
-           (*env)->GetFieldID(env, groupCls, "creator",
-                              "Ljava/lang/String;");
-       if (!group_nameField || !group_cachedInfoField || !group_nameUidField
-           || !group_ownerUidField || !group_creatorUidField
-           || !group_listStatusField || !group_listGroupsOwnedField
-           || !group_listMembershipField || !group_listAddField
-           || !group_listDeleteField || !group_membershipCountField
-           || !group_ownerField || !group_creatorField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-       }
+void internal_getGroupClass( JNIEnv *env, jobject group ) {
+  if( groupCls == 0 ) {
+    groupCls = (*env)->NewGlobalRef( env, (*env)->GetObjectClass(env, group) );
+    if( !groupCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
+    }
+    group_nameField = (*env)->GetFieldID( env, groupCls, "name", 
+                                         "Ljava/lang/String;" );
+    group_cachedInfoField = (*env)->GetFieldID( env, groupCls, "cachedInfo", 
+                                               "Z" );
+    group_nameUidField = (*env)->GetFieldID( env, groupCls, "nameUID", "I" );
+    group_ownerUidField = (*env)->GetFieldID( env, groupCls, "ownerUID", "I" );
+    group_creatorUidField = (*env)->GetFieldID( env, groupCls, "creatorUID", 
+                                               "I" );
+    group_listStatusField = (*env)->GetFieldID( env, groupCls, "listStatus", 
+                                               "I" );
+    group_listGroupsOwnedField = (*env)->GetFieldID( env, groupCls, 
+                                                    "listGroupsOwned", "I" );
+    group_listMembershipField = (*env)->GetFieldID( env, groupCls, 
+                                                   "listMembership", "I" );
+    group_listAddField = (*env)->GetFieldID( env, groupCls, "listAdd", "I" );
+    group_listDeleteField = (*env)->GetFieldID( env, groupCls, "listDelete", 
+                                               "I" );
+    group_membershipCountField = (*env)->GetFieldID( env, groupCls, 
+                                                    "membershipCount", "I" );
+    group_ownerField = (*env)->GetFieldID( env, groupCls, "owner", 
+                                          "Ljava/lang/String;" );
+    group_creatorField = (*env)->GetFieldID( env, groupCls, "creator", 
+                                            "Ljava/lang/String;" );
+    if( !group_nameField || !group_cachedInfoField || !group_nameUidField || 
+       !group_ownerUidField || !group_creatorUidField || 
+       !group_listStatusField || !group_listGroupsOwnedField || 
+       !group_listMembershipField || !group_listAddField || 
+       !group_listDeleteField || !group_membershipCountField || 
+       !group_ownerField || !group_creatorField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
     }
+  }
 }
 
 /**
  * Given a Java environment and an instance of a server, gets the object and
  * field information for the server object from the Java environment.
  */
-void
-internal_getServerClass(JNIEnv * env, jobject server)
-{
-    if (serverCls == 0) {
-       serverCls =
-           (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, server));
-       if (!serverCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       server_nameField =
-           (*env)->GetFieldID(env, serverCls, "name", "Ljava/lang/String;");
-       server_cachedInfoField =
-           (*env)->GetFieldID(env, serverCls, "cachedInfo", "Z");
-       server_databaseField =
-           (*env)->GetFieldID(env, serverCls, "database", "Z");
-       server_fileServerField =
-           (*env)->GetFieldID(env, serverCls, "fileServer", "Z");
-       server_badDatabaseField =
-           (*env)->GetFieldID(env, serverCls, "badDatabase", "Z");
-       server_badFileServerField =
-           (*env)->GetFieldID(env, serverCls, "badFileServer", "Z");
-       server_IPAddressField =
-           (*env)->GetFieldID(env, serverCls, "ipAddresses",
-                              "[Ljava/lang/String;");
-       if (!server_nameField || !server_cachedInfoField
-           || !server_databaseField || !server_fileServerField
-           || !server_badDatabaseField || !server_badFileServerField
-           || !server_IPAddressField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-
-       }
+void internal_getServerClass( JNIEnv *env, jobject server ) {
+  if( serverCls == 0 ) {
+    serverCls = (*env)->NewGlobalRef( env,
+                                      (*env)->GetObjectClass(env, server) );
+    if( !serverCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
+    }
+    server_nameField = (*env)->GetFieldID( env, serverCls, "name", 
+                                          "Ljava/lang/String;" );
+    server_cachedInfoField = (*env)->GetFieldID( env, serverCls, "cachedInfo",
+                                                "Z" );
+    server_databaseField = (*env)->GetFieldID( env, serverCls, "database", 
+                                              "Z" );
+    server_fileServerField = (*env)->GetFieldID( env, serverCls, "fileServer", 
+                                                "Z" );
+    server_badDatabaseField = (*env)->GetFieldID( env, serverCls, 
+                                                 "badDatabase", "Z" );
+    server_badFileServerField = (*env)->GetFieldID( env, serverCls, 
+                                                   "badFileServer", "Z" );
+    server_IPAddressField = (*env)->GetFieldID( env, serverCls, "ipAddresses",
+                                               "[Ljava/lang/String;" );
+    if( !server_nameField || !server_cachedInfoField || !server_databaseField 
+       || !server_fileServerField || !server_badDatabaseField || 
+       !server_badFileServerField || !server_IPAddressField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
     }
+  }
 }
 
 /**
@@ -812,231 +677,220 @@ internal_getServerClass(JNIEnv * env, jobject server)
  * object and field information for the executableTime object from the 
  * Java environment.
  */
-void
-internal_getExecTimeClass(JNIEnv * env, jobject exectime)
-{
-    if (exectimeCls == 0) {
-       exectimeCls =
-           (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, exectime));
-       if (!exectimeCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       exectime_HourField =
-           (*env)->GetFieldID(env, exectimeCls, "hour", "S");
-       exectime_MinField =
-           (*env)->GetFieldID(env, exectimeCls, "minute", "S");
-       exectime_SecField =
-           (*env)->GetFieldID(env, exectimeCls, "second", "S");
-       exectime_DayField = (*env)->GetFieldID(env, exectimeCls, "day", "S");
-       exectime_NowField = (*env)->GetFieldID(env, exectimeCls, "now", "Z");
-       exectime_NeverField =
-           (*env)->GetFieldID(env, exectimeCls, "never", "Z");
-       if (!exectime_HourField || !exectime_MinField || !exectime_SecField
-           || !exectime_DayField || !exectime_NowField
-           || !exectime_NeverField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-
-       }
+void internal_getExecTimeClass( JNIEnv *env, jobject exectime ) {
+  if( exectimeCls == 0 ) {
+    exectimeCls = (*env)->NewGlobalRef( env, 
+                                      (*env)->GetObjectClass(env, exectime) );
+    if( !exectimeCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
     }
+    exectime_HourField  = (*env)->GetFieldID( env, exectimeCls, "hour", "S" );
+    exectime_MinField   = (*env)->GetFieldID( env, exectimeCls, "minute", 
+                                             "S" );
+    exectime_SecField   = (*env)->GetFieldID( env, exectimeCls, "second", 
+                                             "S" );
+    exectime_DayField   = (*env)->GetFieldID( env, exectimeCls, "day", "S" );
+    exectime_NowField   = (*env)->GetFieldID( env, exectimeCls, "now", "Z" );
+    exectime_NeverField = (*env)->GetFieldID( env, exectimeCls, "never", "Z" );
+    if( !exectime_HourField || !exectime_MinField || !exectime_SecField || 
+       !exectime_DayField || !exectime_NowField || !exectime_NeverField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
+    }
+  }
 }
 
 /**
  * Given a Java environment and an instance of a partition, gets the object and
  * field information for the partition object from the Java environment.
  */
-void
-internal_getPartitionClass(JNIEnv * env, jobject partition)
-{
-    if (partitionCls == 0) {
-       partitionCls =
-           (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, partition));
-       if (!partitionCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       partition_nameField =
-           (*env)->GetFieldID(env, partitionCls, "name",
-                              "Ljava/lang/String;");
-       partition_deviceNameField =
-           (*env)->GetFieldID(env, partitionCls, "deviceName",
-                              "Ljava/lang/String;");
-       partition_idField = (*env)->GetFieldID(env, partitionCls, "id", "I");
-       partition_cachedInfoField =
-           (*env)->GetFieldID(env, partitionCls, "cachedInfo", "Z");
-       partition_lockFileDescriptorField =
-           (*env)->GetFieldID(env, partitionCls, "lockFileDescriptor", "I");
-       partition_totalSpaceField =
-           (*env)->GetFieldID(env, partitionCls, "totalSpace", "I");
-       partition_totalFreeSpaceField =
-           (*env)->GetFieldID(env, partitionCls, "totalFreeSpace", "I");
-       if (!partition_nameField || !partition_cachedInfoField
-           || !partition_idField || !partition_deviceNameField
-           || !partition_lockFileDescriptorField
-           || !partition_totalSpaceField || !partition_totalFreeSpaceField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-
-       }
+void internal_getPartitionClass( JNIEnv *env, jobject partition ) {
+  if( partitionCls == 0 ) {
+    partitionCls = (*env)->NewGlobalRef( env, 
+                                     (*env)->GetObjectClass(env, partition) );
+    if( !partitionCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
+    }
+    partition_nameField = (*env)->GetFieldID( env, partitionCls, "name", 
+                                             "Ljava/lang/String;" );
+    partition_deviceNameField = (*env)->GetFieldID( env, partitionCls, 
+                                                   "deviceName", 
+                                                   "Ljava/lang/String;" );
+    partition_idField = (*env)->GetFieldID( env, partitionCls, "id", "I" );
+    partition_cachedInfoField = (*env)->GetFieldID( env, partitionCls, 
+                                                   "cachedInfo", "Z" );
+    partition_lockFileDescriptorField = (*env)->GetFieldID( env, partitionCls,
+                                                         "lockFileDescriptor",
+                                                           "I" );
+    partition_totalSpaceField = (*env)->GetFieldID( env, partitionCls, 
+                                                   "totalSpace", "I" );
+    partition_totalFreeSpaceField = (*env)->GetFieldID( env, partitionCls, 
+                                                       "totalFreeSpace", "I");
+    if( !partition_nameField || !partition_cachedInfoField || 
+       !partition_idField || !partition_deviceNameField || 
+       !partition_lockFileDescriptorField || !partition_totalSpaceField || 
+       !partition_totalFreeSpaceField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
     }
+  }
 }
 
 /**
  * Given a Java environment and an instance of a volume, gets the object and
  * field information for the volume object from the Java environment.
  */
-void
-internal_getVolumeClass(JNIEnv * env, jobject volume)
-{
-    if (volumeCls == 0) {
-       volumeCls =
-           (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, volume));
-       if (!volumeCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       volume_nameField =
-           (*env)->GetFieldID(env, volumeCls, "name", "Ljava/lang/String;");
-       volume_cachedInfoField =
-           (*env)->GetFieldID(env, volumeCls, "cachedInfo", "Z");
-       volume_idField = (*env)->GetFieldID(env, volumeCls, "id", "I");
-       volume_readWriteIdField =
-           (*env)->GetFieldID(env, volumeCls, "readWriteID", "I");
-       volume_readOnlyIdField =
-           (*env)->GetFieldID(env, volumeCls, "readOnlyID", "I");
-       volume_backupIdField =
-           (*env)->GetFieldID(env, volumeCls, "backupID", "I");
-       volume_creationDateField =
-           (*env)->GetFieldID(env, volumeCls, "creationDate", "J");
-       volume_lastAccessDateField =
-           (*env)->GetFieldID(env, volumeCls, "lastAccessDate", "J");
-       volume_lastUpdateDateField =
-           (*env)->GetFieldID(env, volumeCls, "lastUpdateDate", "J");
-       volume_lastBackupDateField =
-           (*env)->GetFieldID(env, volumeCls, "lastBackupDate", "J");
-       volume_copyCreationDateField =
-           (*env)->GetFieldID(env, volumeCls, "copyCreationDate", "J");
-       volume_accessesSinceMidnightField =
-           (*env)->GetFieldID(env, volumeCls, "accessesSinceMidnight", "I");
-       volume_fileCountField =
-           (*env)->GetFieldID(env, volumeCls, "fileCount", "I");
-       volume_maxQuotaField =
-           (*env)->GetFieldID(env, volumeCls, "maxQuota", "I");
-       volume_currentSizeField =
-           (*env)->GetFieldID(env, volumeCls, "currentSize", "I");
-       volume_statusField =
-           (*env)->GetFieldID(env, volumeCls, "status", "I");
-       volume_dispositionField =
-           (*env)->GetFieldID(env, volumeCls, "disposition", "I");
-       volume_typeField = (*env)->GetFieldID(env, volumeCls, "type", "I");
-       if (!volume_nameField || !volume_cachedInfoField || !volume_idField
-           || !volume_readWriteIdField || !volume_readOnlyIdField
-           || !volume_backupIdField || !volume_creationDateField
-           || !volume_lastAccessDateField || !volume_lastUpdateDateField
-           || !volume_lastBackupDateField || !volume_copyCreationDateField
-           || !volume_accessesSinceMidnightField || !volume_fileCountField
-           || !volume_maxQuotaField || !volume_currentSizeField
-           || !volume_statusField || !volume_dispositionField
-           || !volume_typeField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-
-       }
+void internal_getVolumeClass( JNIEnv *env, jobject volume ) {
+  if( volumeCls == 0 ) {
+    volumeCls = (*env)->NewGlobalRef( env, 
+                                     (*env)->GetObjectClass(env, volume) );
+    if( !volumeCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
     }
+    volume_nameField = (*env)->GetFieldID( env, volumeCls, "name", 
+                                          "Ljava/lang/String;" );
+    volume_cachedInfoField = (*env)->GetFieldID( env, volumeCls, "cachedInfo", 
+                                                "Z" );
+    volume_idField = (*env)->GetFieldID( env, volumeCls, "id", "I" );
+    volume_readWriteIdField = (*env)->GetFieldID( env, volumeCls, 
+                                                 "readWriteID", "I" );
+    volume_readOnlyIdField = (*env)->GetFieldID( env, volumeCls, "readOnlyID", 
+                                                "I" );
+    volume_backupIdField = (*env)->GetFieldID( env, volumeCls, "backupID", 
+                                              "I" );
+    volume_creationDateField = (*env)->GetFieldID( env, volumeCls, 
+                                                  "creationDate", "J" );
+    volume_lastAccessDateField = (*env)->GetFieldID( env, volumeCls, 
+                                                    "lastAccessDate", "J" );
+    volume_lastUpdateDateField = (*env)->GetFieldID( env, volumeCls, 
+                                                    "lastUpdateDate", "J" );
+    volume_lastBackupDateField = (*env)->GetFieldID( env, volumeCls, 
+                                                    "lastBackupDate", "J" );
+    volume_copyCreationDateField = (*env)->GetFieldID( env, volumeCls, 
+                                                      "copyCreationDate", 
+                                                      "J" );
+    volume_accessesSinceMidnightField = (*env)->GetFieldID( env, volumeCls, 
+                                                      "accessesSinceMidnight",
+                                                           "I" );
+    volume_fileCountField = (*env)->GetFieldID( env, volumeCls, "fileCount", 
+                                               "I" );
+    volume_maxQuotaField = (*env)->GetFieldID( env, volumeCls, "maxQuota", 
+                                              "I" );
+    volume_currentSizeField = (*env)->GetFieldID( env, volumeCls, 
+                                                 "currentSize", "I" );
+    volume_statusField = (*env)->GetFieldID( env, volumeCls, "status", "I" );
+    volume_dispositionField = (*env)->GetFieldID( env, volumeCls, 
+                                                 "disposition", "I" );
+    volume_typeField = (*env)->GetFieldID( env, volumeCls, "type", "I" );
+    if( !volume_nameField || !volume_cachedInfoField || !volume_idField || 
+       !volume_readWriteIdField || !volume_readOnlyIdField || 
+       !volume_backupIdField || !volume_creationDateField || 
+       !volume_lastAccessDateField || !volume_lastUpdateDateField || 
+       !volume_lastBackupDateField || !volume_copyCreationDateField || 
+       !volume_accessesSinceMidnightField || !volume_fileCountField || 
+       !volume_maxQuotaField || !volume_currentSizeField || 
+       !volume_statusField || !volume_dispositionField || 
+       !volume_typeField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
+    }
+  }
 }
 
 /**
  * Given a Java environment and an instance of a key, gets the object and
  * field information for the key object from the Java environment.
  */
-void
-internal_getKeyClass(JNIEnv * env, jobject key)
-{
-    if (keyCls == 0) {
-       keyCls = (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, key));
-       if (!keyCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       key_encryptionKeyField =
-           (*env)->GetFieldID(env, keyCls, "encryptionKey",
-                              "Ljava/lang/String;");
-       key_cachedInfoField =
-           (*env)->GetFieldID(env, keyCls, "cachedInfo", "Z");
-       key_versionField = (*env)->GetFieldID(env, keyCls, "version", "I");
-       key_lastModDateField =
-           (*env)->GetFieldID(env, keyCls, "lastModDate", "I");
-       key_lastModMsField =
-           (*env)->GetFieldID(env, keyCls, "lastModMs", "I");
-       key_checkSumField = (*env)->GetFieldID(env, keyCls, "checkSum", "J");
-       if (!key_cachedInfoField || !key_versionField
-           || !key_encryptionKeyField || !key_lastModDateField
-           || !key_lastModMsField || !key_checkSumField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-
-       }
+void internal_getKeyClass( JNIEnv *env, jobject key ) {
+  if( keyCls == 0 ) {
+    keyCls = (*env)->NewGlobalRef( env, (*env)->GetObjectClass(env, key) );
+    if( !keyCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
+    }
+    key_encryptionKeyField = (*env)->GetFieldID( env, keyCls, 
+                                                "encryptionKey", 
+                                                "Ljava/lang/String;" );
+    key_cachedInfoField = (*env)->GetFieldID( env, keyCls, "cachedInfo", "Z" );
+    key_versionField = (*env)->GetFieldID( env, keyCls, "version", "I" );
+    key_lastModDateField = (*env)->GetFieldID( env, keyCls, "lastModDate", 
+                                              "I" );
+    key_lastModMsField = (*env)->GetFieldID( env, keyCls, "lastModMs", "I" );
+    key_checkSumField = (*env)->GetFieldID( env, keyCls, "checkSum", "J" );
+    if( !key_cachedInfoField || !key_versionField || !key_encryptionKeyField 
+       || !key_lastModDateField || !key_lastModMsField || 
+       !key_checkSumField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
     }
+  }
 }
 
 /**
  * Given a Java environment and an instance of a process, gets the object and
  * field information for the process object from the Java environment.
  */
-void
-internal_getProcessClass(JNIEnv * env, jobject process)
-{
-    if (processCls == 0) {
-       processCls =
-           (*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, process));
-       if (!processCls) {
-           throwAFSException(env, JAFSADMCLASSNOTFOUND);
-           return;
-       }
-       process_cachedInfoField =
-           (*env)->GetFieldID(env, processCls, "cachedInfo", "Z");
-       process_nameField =
-           (*env)->GetFieldID(env, processCls, "name", "Ljava/lang/String;");
-       process_typeField = (*env)->GetFieldID(env, processCls, "type", "I");
-       process_stateField =
-           (*env)->GetFieldID(env, processCls, "state", "I");
-       process_goalField = (*env)->GetFieldID(env, processCls, "goal", "I");
-       process_startTimeField =
-           (*env)->GetFieldID(env, processCls, "startTime", "J");
-       process_numberStartsField =
-           (*env)->GetFieldID(env, processCls, "numberStarts", "J");
-       process_exitTimeField =
-           (*env)->GetFieldID(env, processCls, "exitTime", "J");
-       process_exitErrorTimeField =
-           (*env)->GetFieldID(env, processCls, "exitErrorTime", "J");
-       process_errorCodeField =
-           (*env)->GetFieldID(env, processCls, "errorCode", "J");
-       process_errorSignalField =
-           (*env)->GetFieldID(env, processCls, "errorSignal", "J");
-       process_stateOkField =
-           (*env)->GetFieldID(env, processCls, "stateOk", "Z");
-       process_stateTooManyErrorsField =
-           (*env)->GetFieldID(env, processCls, "stateTooManyErrors", "Z");
-       process_stateBadFileAccessField =
-           (*env)->GetFieldID(env, processCls, "stateBadFileAccess", "Z");
-       if (!process_cachedInfoField || !process_nameField
-           || !process_typeField || !process_stateField || !process_goalField
-           || !process_startTimeField || !process_numberStartsField
-           || !process_exitTimeField || !process_exitErrorTimeField
-           || !process_errorCodeField || !process_errorSignalField
-           || !process_stateOkField || !process_stateTooManyErrorsField
-           || !process_stateBadFileAccessField) {
-
-           throwAFSException(env, JAFSADMFIELDNOTFOUND);
-           return;
-
-       }
+void internal_getProcessClass( JNIEnv *env, jobject process ) {
+  if( processCls == 0 ) {
+    processCls = (*env)->NewGlobalRef( env, 
+                                      (*env)->GetObjectClass(env, process) );
+    if( !processCls ) {
+       throwAFSException( env, JAFSADMCLASSNOTFOUND );
+       return;
     }
+    process_cachedInfoField = (*env)->GetFieldID( env, processCls, 
+                                                 "cachedInfo", "Z" );
+    process_nameField = (*env)->GetFieldID( env, processCls, "name", 
+                                           "Ljava/lang/String;" );
+    process_typeField = (*env)->GetFieldID( env, processCls, "type", "I" );
+    process_stateField = (*env)->GetFieldID( env, processCls, "state", "I" );
+    process_goalField = (*env)->GetFieldID( env, processCls, "goal", "I" );
+    process_startTimeField = (*env)->GetFieldID( env, processCls, "startTime", 
+                                                "J" ); 
+    process_numberStartsField = (*env)->GetFieldID( env, processCls, 
+                                                   "numberStarts", "J" ); 
+    process_exitTimeField = (*env)->GetFieldID( env, processCls, "exitTime", 
+                                               "J" ); 
+    process_exitErrorTimeField = (*env)->GetFieldID( env, processCls, 
+                                                    "exitErrorTime", "J" ); 
+    process_errorCodeField = (*env)->GetFieldID( env, processCls, "errorCode", 
+                                                "J" ); 
+    process_errorSignalField = (*env)->GetFieldID( env, processCls, 
+                                                  "errorSignal", "J" ); 
+    process_stateOkField = (*env)->GetFieldID( env, processCls, "stateOk", 
+                                              "Z" ); 
+    process_stateTooManyErrorsField = (*env)->GetFieldID( env, processCls, 
+                                                         "stateTooManyErrors",
+                                                         "Z" ); 
+    process_stateBadFileAccessField = (*env)->GetFieldID( env, processCls, 
+                                                         "stateBadFileAccess",
+                                                         "Z" ); 
+    if( !process_cachedInfoField || !process_nameField || !process_typeField 
+       || !process_stateField || !process_goalField || 
+       !process_startTimeField || !process_numberStartsField || 
+       !process_exitTimeField || !process_exitErrorTimeField || 
+       !process_errorCodeField || !process_errorSignalField || 
+       !process_stateOkField || !process_stateTooManyErrorsField || 
+       !process_stateBadFileAccessField ) {
+
+       throwAFSException( env, JAFSADMFIELDNOTFOUND );
+       return;
+
+    }
+  }
 }
 
 #endif /* LIBJUAFS */
+
+
index b08eea6..29d9129 100644 (file)
@@ -4,77 +4,60 @@
 #include <jni.h>
 #include "Exceptions.h"
 
-/** 
- * ERROR CODES
- *
- * Please add any internal error codes to the ErrorMessages.properties
- * file located in src/JAVA/classes/
- */
-#define JAFSADMNOMEM          1050     // Memory problems
-#define JAFSADMCLASSNOTFOUND  1051     // Trouble finding a Java class
-#define JAFSADMMETHODNOTFOUND 1052     // Trouble finding a Java method
-#define JAFSADMFIELDNOTFOUND  1053     // Trouble finding a Java field
-#define JAFSNULLARG           1054     // Null argument (general)
-#define JAFSNULLUSER          1055     // User argument null
-#define JAFSNULLPASS          1056     // Password argument null
-#define JAFSNULLGROUP         1057     // Group name argument null
-#define JAFSNULLOWNER         1058     // Group owner name argument null
-#define JAFSNULLVOLUME        1059     // Volume name argument null
-#define JAFSNULLPART          1060     // Partition name argument null
-#define JAFSNULLPROCESS       1061     // Process name argument null
-#define JAFSNULLSERVER        1062     // Server name argument null
-#define JAFSNULLCELL          1063     // Cell name argument null
-#define JAFSNULLPATH          1064     // Path argument null
-#define JAFSNULLACL           1065     // ACL string argument null
-
 #ifndef LIBJUAFS
 #include <afs_Admin.h>
 #include <afs_kasAdmin.h>
 
+// error codes
+#define JAFSADMNOMEM 1050             // Memory problems
+#define JAFSADMCLASSNOTFOUND  1051    // Trouble finding a Java class
+#define JAFSADMMETHODNOTFOUND 1052    // Trouble finding a Java method
+#define JAFSADMFIELDNOTFOUND  1053    // Trouble finding a Java field
+
 // make an identity out of a full name (possibly including an instance ) 
-void internal_makeKasIdentity(const char *fullName, kas_identity_p who);
-
-void internal_getUserClass(JNIEnv * env, jobject user);
-void internal_getGroupClass(JNIEnv * env, jobject group);
-void internal_getServerClass(JNIEnv * env, jobject server);
-void internal_getPartitionClass(JNIEnv * env, jobject partition);
-void internal_getVolumeClass(JNIEnv * env, jobject volume);
-void internal_getKeyClass(JNIEnv * env, jobject key);
-void internal_getProcessClass(JNIEnv * env, jobject process);
+void internal_makeKasIdentity( const char *fullName, kas_identity_p who );
+
+void internal_getUserClass( JNIEnv *env, jobject user );
+void internal_getGroupClass( JNIEnv *env, jobject group );
+void internal_getServerClass( JNIEnv *env, jobject server );
+void internal_getPartitionClass( JNIEnv *env, jobject partition );
+void internal_getVolumeClass( JNIEnv *env, jobject volume );
+void internal_getKeyClass( JNIEnv *env, jobject key );
+void internal_getProcessClass( JNIEnv *env, jobject process );
 #else
-int openAFSFile(JNIEnv * env, jstring fileNameUTF, int flags, int mode,
-               int *err);
+int openAFSFile(JNIEnv *env, jstring fileNameUTF, int flags, int mode, int *err);
 int readCacheParms(char *afsMountPoint, char *afsConfDir, char *afsCacheDir,
-                  int *cacheBlocks, int *cacheFiles, int *cacheStatEntries,
-                  int *dCacheSize, int *vCacheSize, int *chunkSize,
-                  int *closeSynch, int *debug, int *nDaemons,
-                  int *cacheFlags, char *logFile);
+                   int *cacheBlocks, int *cacheFiles, int *cacheStatEntries,
+                   int *dCacheSize, int *vCacheSize, int *chunkSize,
+                   int *closeSynch, int *debug, int *nDaemons, int *cacheFlags,
+                   char *logFile);
 #endif /* !LIBJUAFS */
 
 // throw a non-AFS exception with a message
-void throwMessageException(JNIEnv * env, char *msg);
+void throwMessageException( JNIEnv *env, char *msg );
 
 // throw an AFS exception with a message
-void throwAFSException(JNIEnv * env, int code);
+void throwAFSException( JNIEnv *env, int code );
 
 // throw an AFS Admin exception with a message
-void throwAFSException(JNIEnv * env, int code);
+void throwAFSException( JNIEnv *env, int code );
 
 // throw an AFS File or I/O related exception with a message
-void throwFileAdminException(JNIEnv * env, int code, char *msg);
+void throwFileAdminException( JNIEnv *env, int code, char *msg );
 
 // throw an AFS Security exception with a message
-void throwAFSSecurityException(JNIEnv * env, int code);
+void throwAFSSecurityException( JNIEnv *env, int code );
 
 // throw an exception with an error code
-void throwException(JNIEnv * env, jclass * excCls, char *excClsName,
-                   jmethodID * initID, int code);
+void throwException( JNIEnv *env, jclass *excCls, char *excClsName, jmethodID *initID, int code );
 
 // reclaim global memory used by exceptions 
-void reclaimExceptionMemory(JNIEnv * env, jclass cls);
+void reclaimExceptionMemory( JNIEnv *env, jclass cls );
 
-int setError(JNIEnv * env, jobject * obj, int code);
-int setString(JNIEnv * env, jobject * obj, char *field, char *string);
-char *getNativeString(JNIEnv * env, jstring jstr);
+int setError(JNIEnv *env, jobject *obj, int code);
+int setString(JNIEnv *env, jobject *obj, char *field, char *string);
 
 #endif
+
+
+
diff --git a/src/JAVA/libjafs/JAFS_Version.h b/src/JAVA/libjafs/JAFS_Version.h
new file mode 100644 (file)
index 0000000..b35bb17
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __JAFS_VERSION_H_1234__
+#define __JAFS_VERSION_H_1234__
+
+#include "Internal.h"
+
+#define VERSION_LIB_JAVA_OPENAFS "20050928_01"
+
+extern char cml_version_number[]; /* from AFS_component_number.c */
+
+#endif /* __JAFS_VERSION_H_1234__ */
index acde7bc..85211c0 100644 (file)
@@ -44,41 +44,40 @@ extern jfieldID key_checkSumField;
  * key      the Key object to populate with the info
  * keyEntry     the container of the key's information
  */
-void
-fillKeyInfo(JNIEnv * env, jobject key, bos_KeyInfo_t keyEntry)
+void fillKeyInfo( JNIEnv *env, jobject key, bos_KeyInfo_t keyEntry )
 {
-    jstring jencryptionKey;
-    char *convertedKey;
-    int i;
-
-    // get the class fields if need be
-    if (keyCls == 0) {
-       internal_getKeyClass(env, key);
-    }
-    // set all the fields
-    (*env)->SetIntField(env, key, key_versionField,
-                       keyEntry.keyVersionNumber);
-
-    convertedKey =
-       (char *)malloc(sizeof(char *) * (sizeof(keyEntry.key.key) * 4 + 1));
-    if (!convertedKey) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-    for (i = 0; i < sizeof(keyEntry.key.key); i++) {
-       sprintf(&(convertedKey[i * 4]), "\\%0.3o", keyEntry.key.key[i]);
-    }
-    jencryptionKey = (*env)->NewStringUTF(env, convertedKey);
-    (*env)->SetObjectField(env, key, key_encryptionKeyField, jencryptionKey);
-
-    (*env)->SetIntField(env, key, key_lastModDateField,
-                       keyEntry.keyStatus.lastModificationDate);
-    (*env)->SetIntField(env, key, key_lastModMsField,
-                       keyEntry.keyStatus.lastModificationMicroSeconds);
-    (*env)->SetLongField(env, key, key_checkSumField,
-                        (unsigned int)keyEntry.keyStatus.checkSum);
-
-    free(convertedKey);
+  jstring jencryptionKey;
+  char *convertedKey;
+  int i;
+
+  // get the class fields if need be
+  if( keyCls == 0 ) {
+    internal_getKeyClass( env, key );
+  }
+
+  // set all the fields
+  (*env)->SetIntField( env, key, key_versionField, keyEntry.keyVersionNumber );
+  
+  convertedKey = (char *) malloc( sizeof(char *)*
+                                 (sizeof(keyEntry.key.key)*4+1) );
+  if( !convertedKey ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+  for( i = 0; i < sizeof(keyEntry.key.key); i++ ) {
+    sprintf( &(convertedKey[i*4]), "\\%0.3o", keyEntry.key.key[i] );
+  }
+  jencryptionKey = (*env)->NewStringUTF(env, convertedKey);
+  (*env)->SetObjectField( env, key, key_encryptionKeyField, jencryptionKey );
+  
+  (*env)->SetIntField( env, key, key_lastModDateField, 
+                      keyEntry.keyStatus.lastModificationDate );
+  (*env)->SetIntField( env, key, key_lastModMsField, 
+                      keyEntry.keyStatus.lastModificationMicroSeconds );
+  (*env)->SetLongField( env, key, key_checkSumField, 
+                       (unsigned int) keyEntry.keyStatus.checkSum );
+
+  free( convertedKey );
 }
 
 /**
@@ -92,56 +91,55 @@ fillKeyInfo(JNIEnv * env, jobject key, bos_KeyInfo_t keyEntry)
  * key     the Key object in which to fill in the 
  *                information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Key_getKeyInfo(JNIEnv * env, jclass cls,
-                                    jint serverHandle, jint version,
-                                    jobject key)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Key_getKeyInfo
+  (JNIEnv *env, jclass cls, jlong serverHandle, jint version, jobject key)
 {
-    afs_status_t ast;
-    bos_KeyInfo_t keyEntry;
-    void *iterationId;
-    int done;
-
-    if (!bos_KeyGetBegin((void *)serverHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
+  afs_status_t ast;
+  bos_KeyInfo_t keyEntry;
+  void *iterationId;
+  int done;
+
+  if( !bos_KeyGetBegin( (void *) serverHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  done = FALSE;
+
+  // there's no KeyGet function, so we must iterate and find the 
+  // one with the matching version
+  while( !done ) {
+
+    if( !bos_KeyGetNext( iterationId, &keyEntry, &ast ) ) {
+      // no matching key
+      if( ast == ADMITERATORDONE ) {
+        afs_status_t astnew;
+        if( !bos_KeyGetDone( iterationId, &astnew ) ) {
+          throwAFSException( env, astnew );
+          return;
+        }
+        throwAFSException( env, KAUNKNOWNKEY );
+        return;
+        // other
+      } else {
+        throwAFSException( env, ast );
+        return;
+      }
     }
 
-    done = FALSE;
-
-    // there's no KeyGet function, so we must iterate and find the 
-    // one with the matching version
-    while (!done) {
-
-       if (!bos_KeyGetNext(iterationId, &keyEntry, &ast)) {
-           // no matching key
-           if (ast == ADMITERATORDONE) {
-               afs_status_t astnew;
-               if (!bos_KeyGetDone(iterationId, &astnew)) {
-                   throwAFSException(env, astnew);
-                   return;
-               }
-               throwAFSException(env, KAUNKNOWNKEY);
-               return;
-               // other
-           } else {
-               throwAFSException(env, ast);
-               return;
-           }
-       }
-
-       if (keyEntry.keyVersionNumber == version) {
-           done = TRUE;
-       }
-
+    if( keyEntry.keyVersionNumber == version ) {
+      done = TRUE;
     }
 
-    fillKeyInfo(env, key, keyEntry);
+  }
 
-    if (!bos_KeyGetDone(iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  fillKeyInfo( env, key, keyEntry );
+
+  if( !bos_KeyGetDone( iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
 }
 
@@ -157,60 +155,63 @@ Java_org_openafs_jafs_Key_getKeyInfo(JNIEnv * env, jclass cls,
  * jkeyString     the String version of the key that will
  *                      be encrypted
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Key_create(JNIEnv * env, jclass cls, jint cellHandle,
-                                jint serverHandle, jint version,
-                                jstring jkeyString)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Key_create
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong serverHandle, jint version, 
+   jstring jkeyString)
 {
     afs_status_t ast;
-    char *keyString;
+    const char *keyString;
     char *cellName;
-    kas_encryptionKey_p key =
-       (kas_encryptionKey_p) malloc(sizeof(kas_encryptionKey_t));
-
-    if (!key) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
+    kas_encryptionKey_p key = 
+      (kas_encryptionKey_p) malloc( sizeof(kas_encryptionKey_t) );
+    
+    if( !key ) {
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
     }
 
-    if (jkeyString != NULL) {
-       keyString = getNativeString(env, jkeyString);
-       if (keyString == NULL) {
-           free(key);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
+    if( jkeyString != NULL ) {
+      keyString = (*env)->GetStringUTFChars(env, jkeyString, 0);
+      if( !keyString ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
     } else {
-       keyString = NULL;
+      keyString = NULL;
     }
 
-    if (!afsclient_CellNameGet((void *)cellHandle, &cellName, &ast)) {
-       free(key);
-       if (keyString != NULL)
-           free(keyString);
-       throwAFSException(env, ast);
+    if( !afsclient_CellNameGet( (void *) cellHandle, &cellName, &ast ) ) {
+       free( key );
+       if( keyString != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jkeyString, keyString);
+       }
+       throwAFSException( env, ast );
        return;
-    }
+    }   
 
-    if (!kas_StringToKey(cellName, keyString, key, &ast)) {
-       free(key);
-       if (keyString != NULL)
-           free(keyString);
-       throwAFSException(env, ast);
+    if( !kas_StringToKey( cellName, keyString, key, &ast ) ) {
+       free( key );
+       if( keyString != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jkeyString, keyString);
+       }
+       throwAFSException( env, ast );
        return;
     }
 
-    if (!bos_KeyCreate((void *)serverHandle, version, key, &ast)) {
-       free(key);
-       if (keyString != NULL)
-           free(keyString);
-       throwAFSException(env, ast);
+    if( !bos_KeyCreate( (void *) serverHandle, version, key, &ast ) ) {
+       free( key );
+       if( keyString != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jkeyString, keyString);
+       }
+       throwAFSException( env, ast );
        return;
     }
 
-    free(key);
-    if (keyString != NULL)
-       free(keyString);
+    free( key );
+    if( keyString != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jkeyString, keyString);
+    }
 }
 
 /**
@@ -221,24 +222,28 @@ Java_org_openafs_jafs_Key_create(JNIEnv * env, jclass cls, jint cellHandle,
  * serverHandle  the bos handle of the server to which the key belongs
  * versionNumber   the version number of the key to remove (0 to 255)
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Key_delete(JNIEnv * env, jclass cls, jint serverHandle,
-                                jint version)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Key_delete
+  (JNIEnv *env, jclass cls, jlong serverHandle, jint version )
 {
     afs_status_t ast;
 
-    if (!bos_KeyDelete((void *)serverHandle, version, &ast)) {
-       throwAFSException(env, ast);
+    if( !bos_KeyDelete( (void *) serverHandle, version, &ast ) ) {
+       throwAFSException( env, ast );
        return;
     }
 }
 
 // reclaim global memory being used by this portion
 JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Key_reclaimKeyMemory(JNIEnv * env, jclass cls)
+Java_org_openafs_jafs_Key_reclaimKeyMemory (JNIEnv *env, jclass cls)
 {
-    if (keyCls) {
-       (*env)->DeleteGlobalRef(env, keyCls);
-       keyCls = 0;
-    }
+  if( keyCls ) {
+      (*env)->DeleteGlobalRef(env, keyCls);
+      keyCls = 0;
+  }
 }
+
+
+
+
index 0ae417c..27a313b 100644 (file)
@@ -5,13 +5,15 @@
 # License.  For details, see the LICENSE file in the top-level source
 # directory or online at http://www.openafs.org/dl/license10.html
 
+include ../../config/Makefile.config
+#${SYS_NAME}
+
 DEST=@DEST@
 TOP_SRCDIR=@TOP_SRCDIR@
 TOP_INCDIR=@TOP_INCDIR@
 TOP_LIBDIR=@TOP_LIBDIR@
-TOP_JLIBDIR=@TOP_JLIBDIR@
-JAVA_HOME=@JAVA_HOME@
-JNI_INC=@JNI_INC@
+TOP_JLIBDIR=@TOP_SRCDIR@/JAVA/libjafs
+JNI_INC=${JAVA_HOME}/include
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 bindir=@bindir@
@@ -27,36 +29,28 @@ COMPILE_ET=${TOP_SRCDIR}/comerr/compile_et
 RXGEN=${TOP_SRCDIR}/rxgen/rxgen
 SYS_NAME=@AFS_SYSNAME@
 
-include ../../config/Makefile.${SYS_NAME}
 
 CC = ${MT_CC}
-SHARED_FLAGS = -shared
+SHARED_FLAGS = -shared -Xlinker -Bsymbolic
 OBJECT_FLAGS = -fPIC -c
 
 ifeq "$(BUILD_TYPE)" "admin"
-       INC := -I${TOP_INCDIR} -I${TOP_INCDIR}/afs/ ${JNI_INC}
+       INC := -I${TOP_INCDIR} -I${TOP_INCDIR}/afs/ -I${JAVA_HOME}/include -I ${JNI_INC}
        CFLAGS := ${INC} ${DBG} ${OPTMZ} -I${TOP_SRCDIR}/config ${MT_CFLAGS}
 else
-       INC := -I${TOP_SRCDIR}/libuafs -I${TOP_INCDIR} -I${TOP_SRCDIR} ${JNI_INC}
+       INC := -I${TOP_SRCDIR}/libuafs -I${TOP_INCDIR} -I${JAVA_HOME}/include -I ${JNI_INC}
        CFLAGS := ${INC} ${DBG} ${OPTMZ} ${FSINCLUDES} -D_REENTRANT -DLIBJUAFS ${MT_CFLAGS}
 endif
 
-ifeq "$(INCREMENT_BUILD)" "false"
-       INCREMENT_CMD :=
-else
-       INCREMENT_CMD := ${RM} -f ${LIBJAFSADMDIR}VersionInfo.o; perl buildinfo.pl ${LIBJAFSADMDIR}VersionInfo.h -i;
-endif
 
 LIBJAFSADMDIR = ./
 ROOTPACKAGEDIR = ../classes
 RELPACKAGEDIR = org/openafs/jafs/
 PACKAGEDIR = ${ROOTPACKAGEDIR}/${RELPACKAGEDIR}
-JAVADOCSDIR = ../javadocs/
-BUILD_VERSION = `perl buildinfo.pl ${LIBJAFSADMDIR}VersionInfo.h -version`
+JAVADOCSDIR = javadocs/
 
 JAVAH = ${JAVA_HOME}/bin/javah -classpath ${ROOTPACKAGEDIR} -jni -d ${LIBJAFSADMDIR}
 JAVAC = ${JAVA_HOME}/bin/javac -classpath ${ROOTPACKAGEDIR}
-JAVADOC = ${JAVA_HOME}/bin/javadoc
 
 J_NATIVE_PREFIX = org.openafs.jafs.
 C_NATIVE_PREFIX = org_openafs_jafs_
@@ -77,19 +71,47 @@ PACKAGE =\
        ${PACKAGEDIR}Server.class \
        ${PACKAGEDIR}Token.class \
        ${PACKAGEDIR}User.class \
-       ${PACKAGEDIR}VersionInfo.class \
-       ${PACKAGEDIR}Volume.class
+       ${PACKAGEDIR}Volume.class \
+       ${PACKAGEDIR}VersionInfo.class
 
+ifeq (${SYS_NAME}, ppc64_linux26)
+LIBJAFS_OBJS =
+else
+ifeq (${SYS_NAME}, s390x_linux26)
+LIBJAFS_OBJS =
+else
 LIBJAFS_OBJS =\
-       ${LIBJAFSADMDIR}ACL.o \
+        ${LIBJAFSADMDIR}GetNativeString.o \
+        ${LIBJAFSADMDIR}ACL.o
+endif
+endif
+
+LIBJAFS_OBJS +=\
        ${LIBJAFSADMDIR}File.o \
        ${LIBJAFSADMDIR}FileInputStream.o \
        ${LIBJAFSADMDIR}FileOutputStream.o \
        ${LIBJAFSADMDIR}Internal.o \
        ${LIBJAFSADMDIR}UserToken.o \
-       ${LIBJAFSADMDIR}VersionInfo.o
+       ${LIBJAFSADMDIR}VersionInfo.o \
+       ${TOP_SRCDIR}/libuafs/UAFS/AFS_component_version_number.o \
+       ${TOP_SRCDIR}/libuafs/UAFS/xdr_int32.o \
+        ${TOP_SRCDIR}/util/rxkstats.o
 
+ifeq (${SYS_NAME}, ppc64_linux26)
+LIBJAFSADM_OBJS =\
+        ${LIBJAFSADMDIR}GetNativeString.o \
+        ${LIBJAFSADMDIR}ACL.o
+else
+ifeq (${SYS_NAME}, s390x_linux26)
 LIBJAFSADM_OBJS =\
+        ${LIBJAFSADMDIR}GetNativeString.o \
+        ${LIBJAFSADMDIR}ACL.o
+else
+LIBJAFSADM_OBJS =
+endif
+endif
+
+LIBJAFSADM_OBJS +=\
        ${LIBJAFSADMDIR}AdminToken.o \
        ${LIBJAFSADMDIR}Cell.o \
        ${LIBJAFSADMDIR}Group.o \
@@ -99,7 +121,8 @@ LIBJAFSADM_OBJS =\
        ${LIBJAFSADMDIR}Process.o \
        ${LIBJAFSADMDIR}Server.o \
        ${LIBJAFSADMDIR}User.o \
-       ${LIBJAFSADMDIR}VersionInfo.o \
+       ${LIBJAFSADMDIR}Version2.o \
+       ${TOP_SRCDIR}/libuafs/UAFS/AFS_component_version_number.o \
        ${LIBJAFSADMDIR}Volume.o
 
 CORRELATING_SOURCE_FILES =\
@@ -114,8 +137,9 @@ CORRELATING_SOURCE_FILES =\
        ${LIBJAFSADMDIR}Process.c \
        ${LIBJAFSADMDIR}Server.c \
        ${LIBJAFSADMDIR}User.c \
-       ${LIBJAFSADMDIR}VersionInfo.c \
-       ${LIBJAFSADMDIR}Volume.c
+       ${LIBJAFSADMDIR}Volume.c \
+       ${LIBJAFSADMDIR}VersionInfo.c
+
 
 JAVA_HEADERS = ${PACKAGE:${PACKAGEDIR}%.class=${C_NATIVE_PREFIX}%.h}
 
@@ -151,7 +175,7 @@ LIBJAFSADM_LIBS =\
 
 JARFILE = jafs.jar
 
-all:  ${TOP_JLIBDIR} libjafs libjafsadm ${PACKAGE} jar
+all:  ${TOP_JLIBDIR} libjafs libjafsadm ${PACKAGE} all_jar
 
 install:  all ${DESTDIR}${libdir}/libjafs.so ${DESTDIR}${libdir}/libjafsadm.so ${PACKAGE} install_jar
        if [ ! -e /usr/afswsp ]; then \
@@ -174,39 +198,27 @@ install:  all ${DESTDIR}${libdir}/libjafs.so ${DESTDIR}${libdir}/libjafsadm.so $
          ln -s /usr/vice/etc/ThisCell /usr/afswsp/etc/; \
        fi
 
-### Clean "C" and Java objects
 clean:
-       ${RM} -f ${PACKAGEDIR}*.class ${LIBJAFSADMDIR}*.o ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}*.h ${LIBJAFSADMDIR}acltest
-       ${RM} -fR ${JAVADOCSDIR}
-
-### Clean just "C" objects
-cleanc:
-       ${RM} -f ${LIBJAFSADMDIR}*.o ${LIBJAFSADMDIR}acltest
-
-increment-build:
-       ${INCREMENT_CMD} \
-        export INCREMENT_BUILD=false;
+       ${RM} -f ${PACKAGEDIR}*.class ${LIBJAFSADMDIR}*.o ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}*.h
 
 setup: FORCE
+       if [ ! -e ./h ]; then \
+         ln -s /usr/include/sys h; \
+       fi; \
 
 ${TOP_JLIBDIR}:
        mkdir -p $@
 
 FORCE: ;
 
-############# Test program   ###############################
-
-acltest: ${LIBJAFSADMDIR}/acltest.c
-       ${CC} ${CFLAGS} -o $@ $^ ${LIBJAFS_LIBS}
-
 ############# Shared library ###############################
 
-libjafs: setup increment-build
+libjafs: setup
        ${RM} -f ${LIBJAFSADMDIR}Internal.o; \
        export BUILD_TYPE=user; \
        ${MAKE} ${TOP_LIBDIR}/libjafs.so
 
-libjafsadm: increment-build
+libjafsadm:
        ${RM} -f ${LIBJAFSADMDIR}Internal.o; \
        export BUILD_TYPE=admin; \
        ${MAKE} ${TOP_LIBDIR}/libjafsadm.so
@@ -214,7 +226,7 @@ libjafsadm: increment-build
 ${TOP_LIBDIR}/libjafs.so: ${LIBJAFS_OBJS}
        ${CC} ${CFLAGS} ${SHARED_FLAGS} -o $@ $^ ${LIBJAFS_LIBS}
 
-${DESTDIR}${libdir}/libjafs.so: ${LIBJAFS_OBJS}
+${DESTDIR}${libdir}/libjafs.so: ${LIBJAFS_OBJS}192.168.13.10
        ${CC} ${CFLAGS} ${SHARED_FLAGS} -o $@ $^ ${LIBJAFS_LIBS}
 
 ${TOP_LIBDIR}/libjafsadm.so: ${LIBJAFSADM_OBJS}
@@ -230,15 +242,15 @@ ${LIBJAFSADM_OBJS}: %.o: %.c
 
 ############## C files #####################################
 
-${CORRELATING_SOURCE_FILES}: ${LIBJAFSADMDIR}%.c: ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}%.h ${LIBJAFSADMDIR}Internal.h ${LIBJAFSADMDIR}VersionInfo.h
+${CORRELATING_SOURCE_FILES}: ${LIBJAFSADMDIR}%.c: ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}%.h ${LIBJAFSADMDIR}Internal.h
 
 ${LIBJAFSADMDIR}AdminToken.c: ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}Token.h ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}Cell.h
 
 ${LIBJAFSADMDIR}Internal.c: ${LIBJAFSADMDIR}Internal.h
 
-${LIBJAFSADMDIR}UserToken.c: ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}Token.h
+${LIBJAFSADMDIR}Version2.c: ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}VersionInfo.h ${LIBJAFSADMDIR}JAFS_Version.h
 
-${LIBJAFSADMDIR}VersionInfo.c: ${LIBJAFSADMDIR}VersionInfo.h ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}VersionInfo.h
+${LIBJAFSADMDIR}UserToken.c: ${LIBJAFSADMDIR}${C_NATIVE_PREFIX}Token.h
 
 ############## Package javac section #########################
 
@@ -250,22 +262,9 @@ ${PACKAGEDIR}%.class: ${PACKAGEDIR}%.java
 ${JAVA_HEADERS}: ${C_NATIVE_PREFIX}%.h: ${PACKAGEDIR}%.class
        ${JAVAH} ${J_NATIVE_PREFIX}$*
 
-############## Javadoc section ###############################
-
-javadocs:
-       echo "Preparing Javadoc API documentation..."
-       ${JAVADOC} -version -breakiterator \
-       -link http://java.sun.com/j2se/1.4/docs/api/ \
-       -windowtitle "Java AFS API" -header "<B>JAFS API v${BUILD_VERSION}</B>" \
-       -doctitle "<B>JAFS</B> API v${BUILD_VERSION}" \
-       -use -d ${JAVADOCSDIR} \
-       -sourcepath ${ROOTPACKAGEDIR} \
-       -classpath ${ROOTPACKAGEDIR} \
-       -package org.openafs.jafs
-
 ############# JAR file #####################################
 
-jar: clean_jar
+all_jar: clean_jar
        cd ${ROOTPACKAGEDIR}; ${JAVA_HOME}/bin/jar -cMf ${TOP_JLIBDIR}/${JARFILE} *.properties ${RELPACKAGEDIR}*.class
 
 install_jar: clean_jar
@@ -274,6 +273,5 @@ install_jar: clean_jar
 clean_jar:
        ${RM} -f ${TOP_JLIBDIR}/${JARFILE}
 
-clean_libs:
-       ${RM} -f ${TOP_LIBDIR}/libjafs.so ${TOP_LIBDIR}/libjafsadm.so
+
 
index 20823fc..f16cab6 100644 (file)
@@ -40,10 +40,10 @@ extern jfieldID volume_cachedInfoField;
 
 //////////////////////////////////////////////////////////
 
-///// Definition in jafs_Volume.c /////////////////
+///// definition in jafs_Volume.c /////////////////
 
-extern void fillVolumeInfo(JNIEnv * env, jobject volume,
-                          vos_volumeEntry_t volEntry);
+extern void fillVolumeInfo
+            ( JNIEnv *env, jobject volume, vos_volumeEntry_t volEntry );
 
 ///////////////////////////////////////////////////
 
@@ -56,40 +56,40 @@ extern void fillVolumeInfo(JNIEnv * env, jobject volume,
  * partition      the Partition object to populate with the info
  * partEntry     the container of the partition's information
  */
-void
-fillPartitionInfo(JNIEnv * env, jobject partition,
-                 vos_partitionEntry_t partEntry)
+void fillPartitionInfo
+  (JNIEnv *env, jobject partition, vos_partitionEntry_t partEntry)
 {
-    jstring jdeviceName;
-    jstring jpartition;
-    jint id;
-    afs_status_t ast;
-
-    // get the class fields if need be
-    if (partitionCls == 0) {
-       internal_getPartitionClass(env, partition);
-    }
-    // fill name and id in case it's a blank object
-    jpartition = (*env)->NewStringUTF(env, partEntry.name);
-    // get the id
-    if (!vos_PartitionNameToId(partEntry.name, (int *)&id, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
-    (*env)->SetObjectField(env, partition, partition_nameField, jpartition);
-    (*env)->SetIntField(env, partition, partition_idField, id);
-
-    jdeviceName = (*env)->NewStringUTF(env, partEntry.deviceName);
-    (*env)->SetObjectField(env, partition, partition_deviceNameField,
-                          jdeviceName);
-
-    (*env)->SetIntField(env, partition, partition_lockFileDescriptorField,
-                       partEntry.lockFileDescriptor);
-    (*env)->SetIntField(env, partition, partition_totalSpaceField,
-                       partEntry.totalSpace);
-    (*env)->SetIntField(env, partition, partition_totalFreeSpaceField,
-                       partEntry.totalFreeSpace);
-
+  jstring jdeviceName;
+  jstring jpartition;
+  jint id;
+  afs_status_t ast;
+
+  // get the class fields if need be
+  if( partitionCls == 0 ) {
+    internal_getPartitionClass( env, partition );
+  }
+
+  // fill name and id in case it's a blank object
+  jpartition = (*env)->NewStringUTF(env, partEntry.name);
+  // get the id
+  if( !vos_PartitionNameToId( partEntry.name, (int *) &id, &ast ) ) {
+      throwAFSException( env, ast );
+      return;
+  } 
+  (*env)->SetObjectField(env, partition, partition_nameField, jpartition);
+  (*env)->SetIntField(env, partition, partition_idField, id);
+
+  jdeviceName = (*env)->NewStringUTF(env, partEntry.deviceName);
+  (*env)->SetObjectField(env, partition, partition_deviceNameField, 
+                        jdeviceName);
+
+  (*env)->SetIntField(env, partition, partition_lockFileDescriptorField, 
+                     partEntry.lockFileDescriptor);
+  (*env)->SetIntField(env, partition, partition_totalSpaceField, 
+                     partEntry.totalSpace);
+  (*env)->SetIntField(env, partition, partition_totalFreeSpaceField, 
+                     partEntry.totalFreeSpace);
+  
 }
 
 /**
@@ -105,25 +105,22 @@ fillPartitionInfo(JNIEnv * env, jobject partition,
  * jpartitionObject   the Partition object in which to 
  *                    fill in the information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Partition_getPartitionInfo(JNIEnv * env, jclass cls,
-                                                jint cellHandle,
-                                                jint serverHandle,
-                                                jint partition,
-                                                jobject jpartitionObject)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Partition_getPartitionInfo
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong serverHandle, 
+   jint partition, jobject jpartitionObject)
 {
-    afs_status_t ast;
-    vos_partitionEntry_t partEntry;
-
-    // get the partition entry
-    if (!vos_PartitionGet
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, &partEntry, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  vos_partitionEntry_t partEntry;
 
-    fillPartitionInfo(env, jpartitionObject, partEntry);
+  // get the partition entry
+  if ( !vos_PartitionGet( (void *) cellHandle, (void *) serverHandle, NULL, 
+                         (unsigned int) partition, &partEntry, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  fillPartitionInfo( env, jpartitionObject, partEntry );
 
 }
 
@@ -135,34 +132,39 @@ Java_org_openafs_jafs_Partition_getPartitionInfo(JNIEnv * env, jclass cls,
  * jname  the name of the partition in question
  * returns   the id of the partition in question
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Partition_translateNameToID(JNIEnv * env, jclass cls,
-                                                 jstring jname)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Partition_translateNameToID
+  (JNIEnv *env, jclass cls, jstring jname)
 {
-    afs_status_t ast;
-    jint id;
-    char *name;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return -1;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLPART);
-       return -1;
+  afs_status_t ast;
+  jint id;
+  const char *name;
+
+  if( jname != NULL ) {
+    name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
-
-    // get the id
-    if (!vos_PartitionNameToId(name, (unsigned int *)&id, &ast)) {
-       id = -1;
-       throwAFSException(env, ast);
+  } else {
+    name = NULL;
+  }
+
+  // get the id
+  if( !vos_PartitionNameToId( name, (unsigned int *) &id, &ast ) ) {
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
     }
+    throwAFSException( env, ast );
+    return -1;
+  } 
 
-    free(name);
+  if( name != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
+
+  return id;
 
-    return id;
 }
 
 /**
@@ -173,27 +175,30 @@ Java_org_openafs_jafs_Partition_translateNameToID(JNIEnv * env, jclass cls,
  * id  the id of the partition in question
  * returns   the name of the partition in question
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Partition_translateIDToName(JNIEnv * env, jclass cls,
-                                                 jint id)
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Partition_translateIDToName
+ (JNIEnv *env, jclass cls, jint id)
 {
-    afs_status_t ast;
-    char *name = (char *)malloc(sizeof(char) * VOS_MAX_PARTITION_NAME_LEN);
-    jstring jname = NULL;
+  afs_status_t ast;
+  char *name = (char *) malloc( sizeof(char)*VOS_MAX_PARTITION_NAME_LEN);
+  jstring jname;
 
-    if (name == NULL) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return NULL;
-    }
-    // get the name
-    if (vos_PartitionIdToName((unsigned int)id, name, &ast)) {
-       jname = (*env)->NewStringUTF(env, name);
-    } else {
-       throwAFSException(env, ast);
-    }
+  if( !name ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return NULL;    
+  }
+
+  // get the name
+  if( !vos_PartitionIdToName( (unsigned int) id, name, &ast ) ) {
     free(name);
+    throwAFSException( env, ast );
+    return NULL;
+  } 
+
+  jname = (*env)->NewStringUTF(env, name);
+  free(name);
+  return jname;
 
-    return jname;
 }
 
 /**
@@ -208,33 +213,29 @@ Java_org_openafs_jafs_Partition_translateIDToName(JNIEnv * env, jclass cls,
  *                    reside
  * returns total number of volumes hosted by this partition
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Partition_getVolumeCount(JNIEnv * env, jclass cls,
-                                              jint cellHandle,
-                                              jint serverHandle,
-                                              jint partition)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Partition_getVolumeCount
+ (JNIEnv *env, jclass cls, jlong cellHandle, jlong serverHandle, jint partition)
 {
-    afs_status_t ast;
-    void *iterationId;
-    vos_volumeEntry_t volEntry;
-    int i = 0;
-
-    if (!vos_VolumeGetBegin
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  afs_status_t ast;
+  void *iterationId;
+  vos_volumeEntry_t volEntry;
+  int i = 0;
 
-    while (vos_VolumeGetNext((void *)iterationId, &volEntry, &ast))
-       i++;
+  if( !vos_VolumeGetBegin( (void *) cellHandle, (void *) serverHandle, NULL, 
+                          (unsigned int) partition, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  while ( vos_VolumeGetNext( (void *) iterationId, &volEntry, &ast ) ) i++;
+
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 /**
@@ -251,24 +252,21 @@ Java_org_openafs_jafs_Partition_getVolumeCount(JNIEnv * env, jclass cls,
  *                    reside
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Partition_getVolumesBegin(JNIEnv * env, jclass cls,
-                                               jint cellHandle,
-                                               jint serverHandle,
-                                               jint partition)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Partition_getVolumesBegin
+ (JNIEnv *env, jclass cls, jlong cellHandle, jlong serverHandle, jint partition)
 {
 
-    afs_status_t ast;
-    void *iterationId;
+  afs_status_t ast;
+  void *iterationId;
 
-    if (!vos_VolumeGetBegin
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  if( !vos_VolumeGetBegin( (void *) cellHandle, (void *) serverHandle, NULL, 
+                          (unsigned int) partition, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    return (jint) iterationId;
+  return (jlong) iterationId;
 }
 
 /**
@@ -285,37 +283,35 @@ Java_org_openafs_jafs_Partition_getVolumesBegin(JNIEnv * env, jclass cls,
  *                    reside
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Partition_getVolumesBeginAt(JNIEnv * env, jclass cls,
-                                                 jint cellHandle,
-                                                 jint serverHandle,
-                                                 jint partition, jint index)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Partition_getVolumesBeginAt
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong serverHandle,
+   jint partition, jint index)
 {
 
-    afs_status_t ast;
-    void *iterationId;
-    vos_volumeEntry_t volEntry;
-    int i;
-
-    if (!vos_VolumeGetBegin
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
-
-    for (i = 1; i < index; i++) {
-       if (!vos_VolumeGetNext((void *)iterationId, &volEntry, &ast)) {
-           if (ast == ADMITERATORDONE) {
-               return 0;
-           } else {
-               throwAFSException(env, ast);
-               return 0;
-           }
-       }
+  afs_status_t ast;
+  void *iterationId;
+  vos_volumeEntry_t volEntry;
+  int i;
+
+  if( !vos_VolumeGetBegin( (void *) cellHandle, (void *) serverHandle, NULL, 
+                          (unsigned int) partition, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  for ( i = 1; i < index; i++) {
+    if( !vos_VolumeGetNext( (void *) iterationId, &volEntry, &ast ) ) {
+      if( ast == ADMITERATORDONE ) {
+        return 0;
+      } else {
+        throwAFSException( env, ast );
+        return 0;
+      }
     }
+  }
 
-    return (jint) iterationId;
+  return (jlong) iterationId;
 
 }
 
@@ -328,25 +324,25 @@ Java_org_openafs_jafs_Partition_getVolumesBeginAt(JNIEnv * env, jclass cls,
  * iterationId   the iteration ID of this iteration
  * returns the name of the next volume of the server
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Partition_getVolumesNextString(JNIEnv * env, jclass cls,
-                                                    jint iterationId)
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Partition_getVolumesNextString
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
-    jstring jvolume;
-    vos_volumeEntry_t volEntry;
-
-    if (!vos_VolumeGetNext((void *)iterationId, &volEntry, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return NULL;
-       }
+  afs_status_t ast;
+  jstring jvolume;
+  vos_volumeEntry_t volEntry;
+
+  if( !vos_VolumeGetNext( (void *) iterationId, &volEntry, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
     }
+  }
 
-    jvolume = (*env)->NewStringUTF(env, volEntry.name);
-    return jvolume;
+  jvolume = (*env)->NewStringUTF(env, volEntry.name);
+  return jvolume;
 
 }
 
@@ -361,34 +357,33 @@ Java_org_openafs_jafs_Partition_getVolumesNextString(JNIEnv * env, jclass cls,
  *                         of the next volume
  * returns 0 if there are no more volumes, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Partition_getVolumesNext(JNIEnv * env, jclass cls,
-                                              jint iterationId,
-                                              jobject jvolumeObject)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Partition_getVolumesNext
+  (JNIEnv *env, jclass cls, jlong iterationId, jobject jvolumeObject)
 {
-    afs_status_t ast;
-    jstring jvolume;
-    vos_volumeEntry_t volEntry;
-
-    if (!vos_VolumeGetNext((void *)iterationId, &volEntry, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
-    }
+  afs_status_t ast;
+  jstring jvolume;
+  vos_volumeEntry_t volEntry;
 
+  if( !vos_VolumeGetNext( (void *) iterationId, &volEntry, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
+    }
+  }
 
-    fillVolumeInfo(env, jvolumeObject, volEntry);
 
-    // get the class fields if need be
-    if (volumeCls == 0) {
-       internal_getVolumeClass(env, jvolumeObject);
-    }
-    (*env)->SetBooleanField(env, jvolumeObject, volume_cachedInfoField, TRUE);
+  fillVolumeInfo( env, jvolumeObject, volEntry );
 
-    return 1;
+  // get the class fields if need be
+  if( volumeCls == 0 ) {
+    internal_getVolumeClass( env, jvolumeObject );
+  }
+  (*env)->SetBooleanField( env, jvolumeObject, volume_cachedInfoField, TRUE );
+    
+  return 1;
 
 }
 
@@ -404,38 +399,37 @@ Java_org_openafs_jafs_Partition_getVolumesNext(JNIEnv * env, jclass cls,
  * advanceCount     the number of volumes to advance past
  * returns 0 if there are no more volumes, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Partition_getVolumesAdvanceTo(JNIEnv * env, jclass cls,
-                                                   jint iterationId,
-                                                   jobject jvolumeObject,
-                                                   jint advanceCount)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Partition_getVolumesAdvanceTo
+  (JNIEnv *env, jclass cls, jlong iterationId, jobject jvolumeObject,
+   jint advanceCount)
 {
-    afs_status_t ast;
-    jstring jvolume;
-    vos_volumeEntry_t volEntry;
-    int i;
-
-    for (i = 0; i < advanceCount; i++) {
-       if (!vos_VolumeGetNext((void *)iterationId, &volEntry, &ast)) {
-           if (ast == ADMITERATORDONE) {
-               return 0;
-           } else {
-               throwAFSException(env, ast);
-               return 0;
-           }
-       }
+  afs_status_t ast;
+  jstring jvolume;
+  vos_volumeEntry_t volEntry;
+  int i;
+
+  for ( i = 0; i < advanceCount; i++) {
+    if( !vos_VolumeGetNext( (void *) iterationId, &volEntry, &ast ) ) {
+      if( ast == ADMITERATORDONE ) {
+        return 0;
+      } else {
+        throwAFSException( env, ast );
+        return 0;
+      }
     }
+  }
 
 
-    fillVolumeInfo(env, jvolumeObject, volEntry);
+  fillVolumeInfo( env, jvolumeObject, volEntry );
 
-    // get the class fields if need be
-    if (volumeCls == 0) {
-       internal_getVolumeClass(env, jvolumeObject);
-    }
-    (*env)->SetBooleanField(env, jvolumeObject, volume_cachedInfoField, TRUE);
-
-    return 1;
+  // get the class fields if need be
+  if( volumeCls == 0 ) {
+    internal_getVolumeClass( env, jvolumeObject );
+  }
+  (*env)->SetBooleanField( env, jvolumeObject, volume_cachedInfoField, TRUE );
+    
+  return 1;
 }
 
 /**
@@ -445,25 +439,44 @@ Java_org_openafs_jafs_Partition_getVolumesAdvanceTo(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Partition_getVolumesDone(JNIEnv * env, jclass cls,
-                                              jint iterationId)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Partition_getVolumesDone
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
+  afs_status_t ast;
 
-    if (!vos_VolumeGetDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  if( !vos_VolumeGetDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 }
 
 // reclaim global memory being used by this portion
 JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Partition_reclaimPartitionMemory(JNIEnv * env,
-                                                      jclass cls)
+Java_org_openafs_jafs_Partition_reclaimPartitionMemory
+ (JNIEnv *env, jclass cls)
 {
-    if (partitionCls) {
-       (*env)->DeleteGlobalRef(env, partitionCls);
-       partitionCls = 0;
-    }
+  if( partitionCls ) {
+      (*env)->DeleteGlobalRef(env, partitionCls);
+      partitionCls = 0;
+  }
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 4d6b6a6..0c1329d 100644 (file)
@@ -52,142 +52,141 @@ extern jfieldID process_stateBadFileAccessField;
  * processName      the name of the process for which to get the info
  * process      the Process object to populate with the info
  */
-void
-getProcessInfoChar(JNIEnv * env, void *serverHandle, const char *processName,
-                  jobject process)
-{
-    afs_status_t ast;
-    bos_ProcessType_t type;
-    bos_ProcessInfo_t infoEntry;
-    bos_ProcessExecutionState_t state;
-    char *auxStatus;
-
-    // get class fields if need be
-    if (processCls == 0) {
-       internal_getProcessClass(env, process);
-    }
-
-    if (!bos_ProcessInfoGet
-       (serverHandle, processName, &type, &infoEntry, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
-    // set type variable
-    switch (type) {
-    case BOS_PROCESS_SIMPLE:
-       (*env)->SetIntField(env, process, process_typeField,
-                           org_openafs_jafs_Process_SIMPLE_PROCESS);
-       break;
-    case BOS_PROCESS_FS:
-       (*env)->SetIntField(env, process, process_typeField,
-                           org_openafs_jafs_Process_FS_PROCESS);
-       break;
-    case BOS_PROCESS_CRON:
-       (*env)->SetIntField(env, process, process_typeField,
-                           org_openafs_jafs_Process_CRON_PROCESS);
-       break;
-    default:
-       throwAFSException(env, type);
-       return;
-    }
-
-    // set goal variable
-    switch (infoEntry.processGoal) {
-    case BOS_PROCESS_STOPPED:
-       (*env)->SetIntField(env, process, process_goalField,
-                           org_openafs_jafs_Process_STOPPED);
-       break;
-    case BOS_PROCESS_RUNNING:
-       (*env)->SetIntField(env, process, process_goalField,
-                           org_openafs_jafs_Process_RUNNING);
-       break;
-    case BOS_PROCESS_STOPPING:
-       (*env)->SetIntField(env, process, process_goalField,
-                           org_openafs_jafs_Process_STOPPING);
-       break;
-    case BOS_PROCESS_STARTING:
-       (*env)->SetIntField(env, process, process_goalField,
-                           org_openafs_jafs_Process_STARTING);
-       break;
-    default:
-       throwAFSException(env, infoEntry.processGoal);
-       return;
-    }
-
-    // set state variable
-    auxStatus = (char *)malloc(sizeof(char) * BOS_MAX_NAME_LEN);
-    if (!auxStatus) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-    if (!bos_ProcessExecutionStateGet
-       ((void *)serverHandle, processName, &state, auxStatus, &ast)) {
-       free(auxStatus);
-       throwAFSException(env, ast);
-       return;
-    }
-    free(auxStatus);
-
-    switch (state) {
-    case BOS_PROCESS_STOPPED:
-       (*env)->SetIntField(env, process, process_stateField,
-                           org_openafs_jafs_Process_STOPPED);
-       break;
-    case BOS_PROCESS_RUNNING:
-       (*env)->SetIntField(env, process, process_stateField,
-                           org_openafs_jafs_Process_RUNNING);
-       break;
-    case BOS_PROCESS_STOPPING:
-       (*env)->SetIntField(env, process, process_stateField,
-                           org_openafs_jafs_Process_STOPPING);
-       break;
-    case BOS_PROCESS_STARTING:
-       (*env)->SetIntField(env, process, process_stateField,
-                           org_openafs_jafs_Process_STARTING);
-       break;
-    default:
-       throwAFSException(env, state);
-       return;
-    }
-
-    // set longs
-    (*env)->SetLongField(env, process, process_startTimeField,
-                        infoEntry.processStartTime);
-    (*env)->SetLongField(env, process, process_numberStartsField,
-                        infoEntry.numberProcessStarts);
-    (*env)->SetLongField(env, process, process_exitTimeField,
-                        infoEntry.processExitTime);
-    (*env)->SetLongField(env, process, process_exitErrorTimeField,
-                        infoEntry.processExitErrorTime);
-    (*env)->SetLongField(env, process, process_errorCodeField,
-                        infoEntry.processErrorCode);
-    (*env)->SetLongField(env, process, process_errorSignalField,
-                        infoEntry.processErrorSignal);
-
-    // set stateOk to true if no core dump
-    if (infoEntry.state & BOS_PROCESS_CORE_DUMPED) {
-       (*env)->SetBooleanField(env, process, process_stateOkField, FALSE);
-    } else {
-       (*env)->SetBooleanField(env, process, process_stateOkField, TRUE);
-    }
-
-    // set stateTooManyErrors
-    if (infoEntry.state & BOS_PROCESS_TOO_MANY_ERRORS) {
-       (*env)->SetBooleanField(env, process, process_stateTooManyErrorsField,
-                               TRUE);
-    } else {
-       (*env)->SetBooleanField(env, process, process_stateTooManyErrorsField,
-                               FALSE);
-    }
-
-    // set stateBadFileAccess
-    if (infoEntry.state & BOS_PROCESS_BAD_FILE_ACCESS) {
-       (*env)->SetBooleanField(env, process, process_stateBadFileAccessField,
-                               TRUE);
-    } else {
-       (*env)->SetBooleanField(env, process, process_stateBadFileAccessField,
-                               FALSE);
-    }
+void getProcessInfoChar( JNIEnv *env, void *serverHandle, 
+                        const char *processName, jobject process ) {
+
+  afs_status_t ast;
+  bos_ProcessType_t type;
+  bos_ProcessInfo_t infoEntry;
+  bos_ProcessExecutionState_t state;
+  char *auxStatus;
+
+  // get class fields if need be
+  if( processCls == 0 ) {
+    internal_getProcessClass( env, process );
+  }
+
+  if( !bos_ProcessInfoGet( serverHandle, processName, &type, 
+                          &infoEntry, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  // set type variable
+  switch( type ) {
+  case BOS_PROCESS_SIMPLE :
+      (*env)->SetIntField(env, process, process_typeField, 
+                         org_openafs_jafs_Process_SIMPLE_PROCESS);
+      break;
+  case BOS_PROCESS_FS :
+      (*env)->SetIntField(env, process, process_typeField, 
+                         org_openafs_jafs_Process_FS_PROCESS);
+      break;
+  case BOS_PROCESS_CRON :
+      (*env)->SetIntField(env, process, process_typeField, 
+                         org_openafs_jafs_Process_CRON_PROCESS);
+      break;
+  default:
+      throwAFSException( env, type );
+      return;
+  }
+
+  // set goal variable
+  switch( infoEntry.processGoal ) {
+  case BOS_PROCESS_STOPPED :
+      (*env)->SetIntField(env, process, process_goalField, 
+                         org_openafs_jafs_Process_STOPPED);
+      break;
+  case BOS_PROCESS_RUNNING :
+      (*env)->SetIntField(env, process, process_goalField, 
+                         org_openafs_jafs_Process_RUNNING);
+      break;
+  case BOS_PROCESS_STOPPING :
+      (*env)->SetIntField(env, process, process_goalField, 
+                         org_openafs_jafs_Process_STOPPING);
+      break;
+  case BOS_PROCESS_STARTING :
+      (*env)->SetIntField(env, process, process_goalField, 
+                         org_openafs_jafs_Process_STARTING);
+      break;
+  default:
+      throwAFSException( env, infoEntry.processGoal );
+      return;
+  }
+
+  // set state variable
+  auxStatus = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
+  if( !auxStatus ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+  if( !bos_ProcessExecutionStateGet( (void *) serverHandle, processName, 
+                                    &state, auxStatus, &ast ) ) {
+      free( auxStatus );
+      throwAFSException( env, ast );
+      return;
+  }
+  free( auxStatus );
+  switch( state ) {
+  case BOS_PROCESS_STOPPED :
+      (*env)->SetIntField(env, process, process_stateField, 
+                         org_openafs_jafs_Process_STOPPED);
+      break;
+  case BOS_PROCESS_RUNNING :
+      (*env)->SetIntField(env, process, process_stateField, 
+                         org_openafs_jafs_Process_RUNNING);
+      break;
+  case BOS_PROCESS_STOPPING :
+      (*env)->SetIntField(env, process, process_stateField, 
+                         org_openafs_jafs_Process_STOPPING);
+      break;
+  case BOS_PROCESS_STARTING :
+      (*env)->SetIntField(env, process, process_stateField, 
+                         org_openafs_jafs_Process_STARTING);
+      break;
+  default:
+      throwAFSException( env, state );
+      return;
+  }
+
+  // set longs
+  (*env)->SetLongField(env, process, process_startTimeField, 
+                      infoEntry.processStartTime );
+  (*env)->SetLongField(env, process, process_numberStartsField, 
+                      infoEntry.numberProcessStarts );
+  (*env)->SetLongField(env, process, process_exitTimeField, 
+                      infoEntry.processExitTime );
+  (*env)->SetLongField(env, process, process_exitErrorTimeField, 
+                      infoEntry.processExitErrorTime );
+  (*env)->SetLongField(env, process, process_errorCodeField, 
+                      infoEntry.processErrorCode );
+  (*env)->SetLongField(env, process, process_errorSignalField, 
+                      infoEntry.processErrorSignal );
+
+  // set stateOk to true if no core dump
+  if( infoEntry.state & BOS_PROCESS_CORE_DUMPED ) {
+    (*env)->SetBooleanField(env, process, process_stateOkField, FALSE );
+  } else {
+    (*env)->SetBooleanField(env, process, process_stateOkField, TRUE );
+  }
+
+  // set stateTooManyErrors
+  if( infoEntry.state & BOS_PROCESS_TOO_MANY_ERRORS ) {
+    (*env)->SetBooleanField(env, process, 
+                           process_stateTooManyErrorsField, TRUE );
+  } else {
+    (*env)->SetBooleanField(env, process, 
+                           process_stateTooManyErrorsField, FALSE );
+  }
+
+  // set stateBadFileAccess
+  if( infoEntry.state & BOS_PROCESS_BAD_FILE_ACCESS ) {
+    (*env)->SetBooleanField(env, process, 
+                           process_stateBadFileAccessField, TRUE );
+  } else {
+    (*env)->SetBooleanField(env, process, 
+                           process_stateBadFileAccessField, FALSE );
+  }
 
 }
 
@@ -202,32 +201,35 @@ getProcessInfoChar(JNIEnv * env, void *serverHandle, const char *processName,
  * process     the Process object in which to fill 
  *                    in the information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Process_getProcessInfo(JNIEnv * env, jclass cls,
-                                            jint serverHandle, jstring jname,
-                                            jobject process)
-{
-    char *name;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLPROCESS);
-       return;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Process_getProcessInfo (JNIEnv *env, jclass cls, 
+                                                jlong serverHandle, 
+                                                jstring jname, 
+                                                jobject process) {
+
+  const char *name;
+
+  if( jname != NULL ) {
+    name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
+  } else {
+    name = NULL;
+  }
 
-    getProcessInfoChar(env, (void *)serverHandle, name, process);
+  getProcessInfoChar( env, (void *) serverHandle, name, process );
 
-    // set name in case blank object
-    if (processCls == NULL) {
-       internal_getProcessClass(env, process);
+  // set name in case blank object
+  if( name != NULL ) {
+    if( processCls == 0 ) {
+      internal_getProcessClass( env, process );
     }
     (*env)->SetObjectField(env, process, process_nameField, jname);
-    free(name);
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
+
 }
 
 /**
@@ -255,42 +257,44 @@ Java_org_openafs_jafs_Process_getProcessInfo(JNIEnv * env, jclass cls,
  *                   be called when the process terminates.  Can be 
  *                   null
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Process_create(JNIEnv * env, jclass cls,
-                                    jint serverHandle, jstring jname,
-                                    jint jtype, jstring jpath,
-                                    jstring jcronTime, jstring jnotifier)
-{
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Process_create (JNIEnv *env, jclass cls, 
+                                        jlong serverHandle, jstring jname, 
+                                        jint jtype, jstring jpath, 
+                                        jstring jcronTime, 
+                                        jstring jnotifier) {
+
     afs_status_t ast;
     bos_ProcessType_t type;
-    char *name;
-    char *path;
-    char *cronTime;
-    char *notifier;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
+    const char *name;
+    const char *path;
+    const char *cronTime;
+    const char *notifier;
+
+    if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+      if( !name ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
     } else {
-       throwAFSException(env, JAFSNULLPROCESS);
-       return;
+      name = NULL;
     }
 
-    if (jpath != NULL) {
-       path = getNativeString(env, jpath);
-       if (path == NULL) {
-           free(name);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
+    if( jpath != NULL ) {
+      path = (*env)->GetStringUTFChars(env, jpath, 0);
+      if( !path ) {
+       if( name != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jname, name);
        }
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+      }
     } else {
-       path = NULL;
+      path = NULL;
     }
 
-    switch (jtype) {
+    switch( jtype ) {
     case org_openafs_jafs_Process_SIMPLE_PROCESS:
        type = BOS_PROCESS_SIMPLE;
        break;
@@ -301,53 +305,85 @@ Java_org_openafs_jafs_Process_create(JNIEnv * env, jclass cls,
        type = BOS_PROCESS_CRON;
        break;
     default:
-       free(name);
-       if (path != NULL)
-           free(path);
-       throwAFSException(env, jtype);
-       return;
+      if( name != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jname, name);
+      }
+      if( path != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jpath, path);
+      }
+      throwAFSException( env, jtype );
+      return;
     }
 
-    if (jcronTime != NULL) {
-       cronTime = getNativeString(env, jcronTime);
-       if (!cronTime) {
-           free(name);
-           if (path != NULL)
-               free(path);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
+    if( jcronTime != NULL ) {
+       cronTime = (*env)->GetStringUTFChars(env, jcronTime, 0);
+       if( !cronTime ) {
+         if( name != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jname, name);
+         }
+         if( path != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jpath, path);
+         }
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
        }
     } else {
        cronTime = NULL;
     }
 
-    if (jnotifier != NULL) {
-       notifier = getNativeString(env, jnotifier);
-       if (!notifier) {
-           free(name);
-           if (path != NULL)
-               free(path);
-           if (cronTime != NULL)
-               free(cronTime);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
+    if( jnotifier != NULL ) {
+       notifier = (*env)->GetStringUTFChars(env, jnotifier, 0);
+       if( !notifier ) {
+         if( name != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jname, name);
+         }
+         if( path != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jpath, path);
+         }
+         if( cronTime != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jcronTime, cronTime);
+         }
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
        }
     } else {
        notifier = NULL;
     }
 
-    if (!bos_ProcessCreate
-       ((void *)serverHandle, name, type, path, cronTime, notifier, &ast)) {
-       throwAFSException(env, ast);
+    if( !bos_ProcessCreate( (void *) serverHandle, name, type, path, 
+                           cronTime, notifier, &ast ) ) {
+       // release strings
+       if( cronTime != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jcronTime, cronTime);
+       }
+       if( notifier != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jnotifier, notifier);
+       }
+       if( name != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jname, name);
+       }
+       if( path != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jpath, path);
+       }
+       throwAFSException( env, ast );
+       return;
     }
+
+
     // release strings
-    free(name);
-    if (path != NULL)
-       free(path);
-    if (cronTime != NULL)
-       free(cronTime);
-    if (notifier != NULL)
-       free(notifier);
+    if( cronTime != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jcronTime, cronTime);
+    }
+    if( notifier != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jnotifier, notifier);
+    }
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
+    }
+    if( path != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jpath, path);
+    }
+
 }
 
 /**
@@ -359,29 +395,35 @@ Java_org_openafs_jafs_Process_create(JNIEnv * env, jclass cls,
  *                      belongs
  * jname   the name of the process to remove
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Process_delete(JNIEnv * env, jclass cls,
-                                    jint serverHandle, jstring jname)
-{
-    afs_status_t ast;
-    char *name;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Process_delete (JNIEnv *env, jclass cls, 
+                                        jlong serverHandle, jstring jname) {
 
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (!name) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
+    afs_status_t ast;
+    const char *name;
+
+    if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+      if( !name ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
     } else {
-       throwAFSException(env, JAFSNULLPROCESS);
-       return;
+      name = NULL;
     }
 
-    if (!bos_ProcessDelete((void *)serverHandle, name, &ast)) {
-       throwAFSException(env, ast);
+    if( !bos_ProcessDelete( (void *) serverHandle, name, &ast ) ) {
+      if( name != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jname, name);
+      }
+      throwAFSException( env, ast );
+      return;
+    }
+
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
     }
 
-    free(name);
 }
 
 /**
@@ -393,30 +435,36 @@ Java_org_openafs_jafs_Process_delete(JNIEnv * env, jclass cls,
  *                      belongs
  * jname   the name of the process to stop
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Process_stop(JNIEnv * env, jclass cls,
-                                  jint serverHandle, jstring jname)
-{
-    afs_status_t ast;
-    char *name;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Process_stop (JNIEnv *env, jclass cls, 
+                                      jlong serverHandle, jstring jname) {
 
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (!name) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
+    afs_status_t ast;
+    const char *name;
+
+    if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+      if( !name ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
     } else {
-       throwAFSException(env, JAFSNULLPROCESS);
-       return;
+      name = NULL;
     }
 
-    if (!bos_ProcessExecutionStateSet
-       ((void *)serverHandle, name, BOS_PROCESS_STOPPED, &ast)) {
-       throwAFSException(env, ast);
+    if( !bos_ProcessExecutionStateSet( (void *) serverHandle, name, 
+                                      BOS_PROCESS_STOPPED, &ast ) ) {
+      if( name != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jname, name);
+      }
+      throwAFSException( env, ast );
+      return;
+    }
+
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
     }
 
-    free(name);
 }
 
 /**
@@ -428,30 +476,36 @@ Java_org_openafs_jafs_Process_stop(JNIEnv * env, jclass cls,
  *                      belongs
  * jname   the name of the process to start
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Process_start(JNIEnv * env, jclass cls,
-                                   jint serverHandle, jstring jname)
-{
-    afs_status_t ast;
-    char *name;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Process_start (JNIEnv *env, jclass cls, 
+                                       jlong serverHandle, jstring jname) {
 
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (!name) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
+    afs_status_t ast;
+    const char *name;
+
+    if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+      if( !name ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
     } else {
-       throwAFSException(env, JAFSNULLPROCESS);
-       return;
+      name = NULL;
     }
 
-    if (!bos_ProcessExecutionStateSet
-       ((void *)serverHandle, name, BOS_PROCESS_RUNNING, &ast)) {
-       throwAFSException(env, ast);
+    if( !bos_ProcessExecutionStateSet( (void *) serverHandle, name, 
+                                      BOS_PROCESS_RUNNING, &ast ) ) {
+      if( name != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jname, name);
+      }
+      throwAFSException( env, ast );
+      return;
+    }
+
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
     }
 
-    free(name);
 }
 
 /**
@@ -463,37 +517,51 @@ Java_org_openafs_jafs_Process_start(JNIEnv * env, jclass cls,
  *                      belongs
  * jname   the name of the process to restart
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Process_restart(JNIEnv * env, jclass cls,
-                                     jint serverHandle, jstring jname)
-{
-    afs_status_t ast;
-    char *name;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Process_restart (JNIEnv *env, jclass cls, 
+                                         jlong serverHandle, jstring jname) {
 
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (!name) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
+    afs_status_t ast;
+    const char *name;
+
+    if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+      if( !name ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
     } else {
-       throwAFSException(env, JAFSNULLPROCESS);
-       return;
+      name = NULL;
+    }
+
+    if( !bos_ProcessRestart( (void *) serverHandle, name, &ast ) ) {
+      if( name != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jname, name);
+      }
+      throwAFSException( env, ast );
+      return;
     }
 
-    if (!bos_ProcessRestart((void *)serverHandle, name, &ast)) {
-       throwAFSException(env, ast);
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
     }
 
-    free(name);
 }
 
 // reclaim global memory being used by this portion
 JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Process_reclaimProcessMemory(JNIEnv * env, jclass cls)
-{
-    if (processCls) {
-       (*env)->DeleteGlobalRef(env, processCls);
-       processCls = 0;
-    }
+Java_org_openafs_jafs_Process_reclaimProcessMemory (JNIEnv *env, 
+                                                      jclass cls) {
+
+  if( processCls ) {
+      (*env)->DeleteGlobalRef(env, processCls);
+      processCls = 0;
+  }
+
 }
+
+
+
+
+
+
diff --git a/src/JAVA/libjafs/README b/src/JAVA/libjafs/README
new file mode 100644 (file)
index 0000000..3560677
--- /dev/null
@@ -0,0 +1,259 @@
+Java API for OpenAFS (JAFS) README
+Current as of June 4, 2003
+
+##########################################################################
+# Copyright (c) 2001-2002 International Business Machines Corp.          #
+# All rights reserved.                                                   #
+#                                                                        #
+# This software has been released under the terms of the IBM Public      #
+# License.  For details, see the LICENSE file in the top-level source    #
+# directory or online at http://www.openafs.org/dl/license10.html        #
+#                                                                        #
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS    #
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT      #
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  #
+# A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR #
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  #
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,    #
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR     #
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING   #
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     #
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.           #
+##########################################################################
+
+---------------------------------------------------------------------------
+*
+* INTRODUCTION
+*
+---------------------------------------------------------------------------
+
+JAFS is an open source API designed to allow Java programmers the ability
+to create applications for the administration or use of OpenAFS file systems.
+It works by accessing libadmin and libuafs (administrative and user-level 
+libraries that come with OpenAFS) through JNI.  It consists of a Java package 
+called org.openafs.jafs, and two shared libraries libjafsadm.so and libjafs.so.
+
+---------------------------------------------------------------------------
+*
+* USE
+*
+---------------------------------------------------------------------------
+
+There is a version of JAFS that has been compiled on Red Hat Linux 7.3, 
+and can be directly used without compilation.  It was compiled using
+OpenAFS 1.2.10a libraries (with a modified version of libjuafs.a).  It 
+consists of a JAR file (jafs-1.2.10a.jar) and two shared libraries 
+(libjafsadm.so and libjafs.so).  It was compiled using the 
+--enable-transarc-paths on compilation (for use with the OpenAFS RPMs), 
+gcc 2.96, and Java Classic VM version 1.4.1_02.
+
+When you write Java code to use this API, import the
+org.openafs.jafs package. During compilation of your Java code, 
+ensure one of the following conditions are met:
+  - Use the "-classpath" option to javac to specify the jafs.jar file.
+  - Change your $CLASSPATH environment variable to include the
+    jafs.jar file (e.g. export CLASSPATH=$CLASSPATH:jafs.jar
+
+When running an application that uses JAFS, the shared libraries
+need to be found by Java's library loader.  The easiest way to
+accomplish this is to copy these files into the /usr/local/lib/ directory,
+or create symbolic links from that directory to the files.  Alternatively, 
+the directory containing the libraries can also be added to the
+LD_LIBRARY_PATH environment variable.
+
+You also need to have an OpenAFS client set up on your machine
+(preferably version 1.2.10a, but it should work for some past versions as well).
+You can obtain the OpenAFS client and view installation documentation at 
+http://www.openafs.org (the RPMs are easiest to use for Linux).  Also any 
+cells you plan to access through the API must have entries in your
+client's CellServDB file (located in the /usr/vice/etc/ directory in most
+setups).
+
+This API is most effective when used with a cell that uses the kaserver
+for authentication.  It does not currently support alternative methods of
+authentication such as Kerberos V.
+
+If you have successfully set up your Linux 7.3 environment as described
+above, you will be able to develop and execute applications that use
+the JAFS API.
+
+---------------------------------------------------------------------------
+*
+* BUILD
+*
+---------------------------------------------------------------------------
+
+ ** DOWNLOAD SOURCE
+  The first step in compiling your own versions of the library and jar file
+  is to download the OpenAFS source code.  Please follow the directions for
+  for the source you download:
+
+ ** APPLY THE APPROPRIATE PATCH
+  You can apply the appropriate JAFS patch with the following command, 
+  executed from the root directory of the download code 
+  (i.e. openafs-1.2.10a/):
+
+      patch -p1 < xxx.diff
+      (where xxx.diff is one of the following patch files)
+
+  Use the patch respective to the source you are using:
+  * OpenAFS 1.2.6 Source (openafs-1.2.6-src.tar.gz)
+    OpenAFS 1.2.7 Source (openafs-1.2.7-src.tar.gz)
+    OpenAFS 1.2.8 Source (openafs-1.2.8-src.tar.gz)
+
+      jafs-1.2.6-8.diff 
+
+  * OpenAFS 1.2.9 Source (openafs-1.2.9-src.tar.gz)
+
+      jafs-1.2.9.diff 
+
+  * OpenAFS 1.2.10a Source (openafs-1.2.10a-src.tar.gz)
+
+      jafs-1.2.10a.diff 
+
+  * Daily Snapshot / CVS (example: openafs-snap-2003-05-21.tar.gz)
+
+      jafs.diff
+
+
+ ** RUN CONFIGURE
+  From the same directory, run the configure script as you normally would 
+  to compile OpenAFS, but run it with a java-home argument so the script can
+  find your java distribution.  For example:
+
+  ./configure [other options] --java-home=/usr/java/jdk
+
+  NOTE: If the configure script is not within the root source directory,
+        then you will need to first run ./regen.sh to generate the 
+        configure script.  In this case you will need to manually
+        modify the JAFS Makefile by setting the JAVA_HOME variable
+        to your local system's JAVA_HOME. (i.e. /usr/java/jdk)
+
+  The configure script will ensure that this directory contains bin/ and lib/ 
+  subdirectories, and that there are /bin/javac and/bin/javah executables and 
+  an include/jni.h file.  If you don't supply a command line argument for the 
+  java home, the script will look for it in environment variables: first in
+  $JAVA_HOME and then in $JDK_HOME.  Also, note that if you have installed
+  (or are planning to install) OpenAFS by using the RPMs for Linux, you
+  should provide the --enable-transarc-paths configuration option.  If you
+  get a "** Can't determine local cell name" error message, the most likely
+  reason is that you didn't supply this option.
+
+ ** RUN MAKE
+  Finally, do a full build of OpenAFS by executing 'make' in the current
+  directory.  After it finishes, you are ready to compile JAFS.  Execute
+  'make jafs' from that same directory.  Afterward, there will be 
+  libjafsadm.so and libjafs.so in the lib/ directory, and a jafs.jar in the 
+  jlib/ directory. These can be used according to the instructions in the 
+  'USE' section of this document. 
+
+  For additional make options, please refer to the next section "MAKE OPTIONS"
+
+
+---------------------------------------------------------------------------
+*
+* MAKE OPTIONS
+*
+---------------------------------------------------------------------------
+
+Additional make options are available by running 'make' from the 
+src/JAVA/libjafs directory; they are as follows:
+
+make            - Perform a full make of all Java classes, jar archive, and JNI
+                  libraries
+make acltest    - Builds the ACL test program.  Program usage is available by
+                  simply invoking './acltest'
+make clean      - Delete all Java classes, Java API docs, test programs, and C
+                  object files
+make cleanc     - Only delete test programs and C object files.
+make clean_jar  - Delete the Java archive library (jlib/jafs.jar)
+make clean_libs - Delete both JNI shared libraries (lib/libjafs.so and
+                  lib/libjafsadm.so)
+make install    - Performs a full make of all components and then installs all
+                  necessary components to your local system.  This option 
+                  prepares the required '/usr/afswsp/' directory for use by 
+                  the native library.
+make javadocs   - Generate Java API documents (in javadoc format).  Docs are
+                  saved to src/JAVA/javadocs
+make jar        - Builds the Java archive library (containing all Java classes)
+make libjafs    - Builds the user-space library (used for ACL and file access)
+make libjafsadm - Builds the administrative library (used for all admin related 
+                  functions)
+
+---------------------------------------------------------------------------
+*
+* DIRECTORIES, FILES, AND TEST PROGRAMS
+*
+---------------------------------------------------------------------------
+
+src/JAVA/libjafs:
+
+  Within the src/JAVA/libjafs directory you will find a few items in addition
+  to the C source code and Makefiles.  In particular, you will find 'acltest.c',
+  'buildinfo.pl', and a subdirectory 'etc'.
+
+  acltest.c     - A test program that allows testing of the native libraries
+                  ACL calls without going through Java.  
+
+                  *Usage information for this program is available by simply 
+                  invoking './acltest' without any parameters.
+
+  buildinfo.pl  - A perl script that automatically updates the build information
+                  every time the native libraries are compiled.  Additionally,
+                  it automatically increments the build number associate with
+                  the native libraries (found in VersionInfo.h).  It may also
+                  be used to programatically query for build information.
+
+                  *Usage information for this program is available by simply 
+                  invoking 'perl buildinfo.pl' without any parameters.
+
+  etc/          - A directory containing user-space configuration files. These 
+                  files are used for user-space initialization and cache 
+                  configuration and are copied to '/usr/afswsp/etc' if a
+                  'make install' is issued.
+
+src/JAVA/classes:
+
+  Within the src/JAVA/classes directory you will find the root of the Java 
+  package, the error message catalog file, and a test program:
+
+  *.java        - Java classes that comprise the test program.
+
+  adminTest     - A script that invokes the Java console-based test program.
+                  This program can be used to exercise all major API calls 
+                  from Java, thus testing JNI libraries as well as Java code.
+
+                  *Usage information for this program is available via its
+                  help menu: './adminTest help'
+
+  adminTest.properties
+                - Configuration file for the Admin test program (only contains
+                  default cell name for administrator)
+
+  ErrorMessages.properties
+                - Error message catalog file used by the ErrorTable class. Note
+                  that an additional message file can be generated that represents
+                  a language other than english (refer to the ErrorTable API docs
+                  for more information)
+
+  org/          - Root of the Java class package (package: org.openafs.jafs)
+
+
+src/JAVA/javadocs:
+
+  This directory is dynamically generated when you issue a 'make javadocs' from
+  the src/JAVA/libjafs directory. It contains all Java API documentation
+  generated from the Java classes.
+
+---------------------------------------------------------------------------
+*
+* MISC
+*
+---------------------------------------------------------------------------
+
+If you'd like to edit the source code, you'll find the native C code in
+the src/JAVA/libjafs directory, and the Java code in the 
+src/JAVA/classes/org/openafs/jafs/ directory.  Please reference the 
+src/TechNotes-JavaAPI document for more information.
+
index 70adce6..0e9eb2c 100644 (file)
@@ -66,24 +66,35 @@ extern jfieldID user_cachedInfoField;
 
 ///// definition in jafs_Partition.c /////////////////
 
-extern void fillPartitionInfo(JNIEnv * env, jobject partition,
-                             vos_partitionEntry_t partEntry);
+extern void fillPartitionInfo( JNIEnv *env, jobject partition, 
+                              vos_partitionEntry_t partEntry );
 
 ///////////////////////////////////////////////////
 
 ///// definition in jafs_Key.c /////////////////
 
-extern void fillKeyInfo(JNIEnv * env, jobject key, bos_KeyInfo_t keyEntry);
+extern void fillKeyInfo( JNIEnv *env, jobject key, bos_KeyInfo_t keyEntry );
 
 ///////////////////////////////////////////////////
 
 ///// definition in jafs_Process.c /////////////////
 
-extern void getProcessInfoChar(JNIEnv * env, void *serverHandle,
-                              const char *processName, jobject process);
+extern void getProcessInfoChar( JNIEnv *env, void *serverHandle, 
+                               const char *processName, jobject process );
 
 ///////////////////////////////////////////////////
 
+
+void IntIPAddressToString(int iIPAddress, char *strIPAddress)
+{
+    sprintf(strIPAddress, "%d.%d.%d.%d",
+           (int)((iIPAddress >> 24) & 0xFF),
+           (int)((iIPAddress >> 16) & 0xFF),
+           (int)((iIPAddress >>  8) & 0xFF),
+           (int)((iIPAddress     ) & 0xFF)
+    );
+} //IntIPAddressToString
+
 /**
  * Extract the information from the given server entry and populate the
  * given object
@@ -93,98 +104,100 @@ extern void getProcessInfoChar(JNIEnv * env, void *serverHandle,
  * server      the Server object to populate with the info
  * servEntry     the container of the server's information
  */
-void
-fillServerInfo(JNIEnv * env, jint cellHandle, jobject server,
-              afs_serverEntry_t servEntry)
+void fillServerInfo
+  ( JNIEnv *env, void *cellHandle, jobject server, afs_serverEntry_t servEntry )
 {
-    jstring jip;
-    jobjectArray jaddresses;
-    jstring jserver;
-    int i = 0;
-
-    // get the class fields if need be
-    if (serverCls == 0) {
-       internal_getServerClass(env, server);
-    }
-    // in case it's blank
-    jserver = (*env)->NewStringUTF(env, servEntry.serverName);
-    (*env)->SetObjectField(env, server, server_nameField, jserver);
-
-    // let's convert just the addresses in the address array into an IP
-    jaddresses =
-       (jobjectArray) (*env)->GetObjectField(env, server,
-                                             server_IPAddressField);
-    for (i = 0; i < 16; i++) {
+  jstring jip;
+  jobjectArray jaddresses;
+  jstring jserver;
+  int i = 0;
+  char szServerAddr[AFS_MAX_SERVER_NAME_LEN];
+
+  // get the class fields if need be
+  if( serverCls == 0 ) {
+    internal_getServerClass( env, server );
+  }
+
+  // in case it's blank
+  jserver = (*env)->NewStringUTF(env, servEntry.serverName);
+  (*env)->SetObjectField(env, server, server_nameField, jserver);
+
+  // let's convert just the addresses in the address array into an IP
+  jaddresses = (jobjectArray) (*env)->GetObjectField( env, server, 
+                                                     server_IPAddressField );
+
+  for (i = 0; i < AFS_MAX_SERVER_ADDRESS; i++) {
        if (servEntry.serverAddress[i] != 0) {
-           jip = (*env)->NewStringUTF(env, (char *)
-                                      inet_ntoa(htonl
-                                                (servEntry.
-                                                 serverAddress[i])));
-           (*env)->SetObjectArrayElement(env, jaddresses, i, jip);
+         IntIPAddressToString(servEntry.serverAddress[i], szServerAddr);
+         jip = (*env)->NewStringUTF(env, szServerAddr);
+         (*env)->SetObjectArrayElement(env, jaddresses, i, jip);
        } else {
-           break;
+         break;
        }
-    }
-
-    // let's check if this is really a database server
-    (*env)->SetBooleanField(env, server, server_databaseField,
-                           servEntry.serverType & DATABASE_SERVER);
-    if (servEntry.serverType & DATABASE_SERVER) {
-       // for now, if it thinks it's a database server than it is
-       // later, add checks for database configuration, and actual 
-       // on-ness of the machine
-       (*env)->SetBooleanField(env, server, server_badDatabaseField, FALSE);
+  }
+
+  // let's check if this is really a database server
+  (*env)->SetBooleanField(env, server, server_databaseField, 
+                         servEntry.serverType & DATABASE_SERVER);
+
+  if( servEntry.serverType & DATABASE_SERVER ) {
+    // for now, if it thinks it's a database server than it is
+    // later, add checks for database configuration, and actual 
+    // on-ness of the machine
+    (*env)->SetBooleanField(env, server, server_badDatabaseField, FALSE);
+  } else {
+    (*env)->SetBooleanField(env, server, server_badDatabaseField, FALSE);
+  }
+
+  // we should check to see if this is truly a file server or not
+  // it could just be an old remnant, left over inside the vldb that 
+  // should be removed.
+  // if it is a file server, mark it as such.  If not, mark it as faulty.
+  (*env)->SetBooleanField(env, server, server_fileServerField,  
+                         servEntry.serverType & FILE_SERVER);
+
+  if( servEntry.serverType & FILE_SERVER ) {
+    
+    // to see if it's really a file server, make sure the 
+    // "fs" process is running
+    void *bosHandle;
+    afs_status_t ast, ast2;
+    bos_ProcessType_t processTypeT;
+    bos_ProcessInfo_t processInfoT;
+    char *fileServerProcessName = "fs";
+
+    // set the file server to true (it thinks it's a file server)
+    (*env)->SetBooleanField(env, server, server_fileServerField, TRUE);
+
+    if( !bos_ServerOpen( cellHandle, servEntry.serverName, 
+                        &bosHandle, &ast ) ) {
+      throwAFSException( env, ast );
+      return;
+    }
+
+    if( !bos_ProcessInfoGet( bosHandle, fileServerProcessName, &processTypeT, 
+                            &processInfoT, &ast ) ) {
+      // if the machine does not have a fs process or is not responding 
+      // or is part of another cell
+      if( ast == BZNOENT || ast == -1 || ast == RXKADBADTICKET ) {
+        (*env)->SetBooleanField(env, server, server_badFileServerField, TRUE);
+      // otherwise
+      } else {
+        bos_ServerClose( bosHandle, &ast2 );
+        throwAFSException( env, ast );
+        return;
+      }
     } else {
-       (*env)->SetBooleanField(env, server, server_badDatabaseField, FALSE);
+      // it's good
+      (*env)->SetBooleanField(env, server, server_badFileServerField, FALSE);
     }
-
-    // we should check to see if this is truly a file server or not
-    // it could just be an old remnant, left over inside the vldb that 
-    // should be removed.
-    // if it is a file server, mark it as such.  If not, mark it as faulty.
-    (*env)->SetBooleanField(env, server, server_fileServerField,
-                           servEntry.serverType & FILE_SERVER);
-    if (servEntry.serverType & FILE_SERVER) {
-
-       // to see if it's really a file server, make sure the 
-       // "fs" process is running
-       void *bosHandle;
-       afs_status_t ast;
-       bos_ProcessType_t processTypeT;
-       bos_ProcessInfo_t processInfoT;
-       char *fileServerProcessName = "fs";
-
-       // set the file server to true (it thinks it's a file server)
-       (*env)->SetBooleanField(env, server, server_fileServerField, TRUE);
-
-       if (!bos_ServerOpen
-           ((void *)cellHandle, servEntry.serverName, &bosHandle, &ast)) {
-           throwAFSException(env, ast);
-           return;
-       }
-       if (!bos_ProcessInfoGet
-           (bosHandle, fileServerProcessName, &processTypeT, &processInfoT,
-            &ast)) {
-           // if the machine does not have a fs process or is not responding 
-           // or is part of another cell
-           if (ast == BZNOENT || ast == -1 || ast == RXKADBADTICKET) {
-               (*env)->SetBooleanField(env, server,
-                                       server_badFileServerField, TRUE);
-               // otherwise
-           } else {
-               throwAFSException(env, ast);
-               return;
-           }
-       } else {
-           // it's good
-           (*env)->SetBooleanField(env, server, server_badFileServerField,
-                                   FALSE);
-       }
-    } else {
-       (*env)->SetBooleanField(env, server, server_badFileServerField,
-                               FALSE);
+    if (!bos_ServerClose( bosHandle, &ast )) {
+      throwAFSException( env, ast );
+      return;
     }
-
+  } else {
+    (*env)->SetBooleanField(env, server, server_badFileServerField, FALSE);
+  }
 }
 
 /**
@@ -197,34 +210,41 @@ fillServerInfo(JNIEnv * env, jint cellHandle, jobject server,
  * server     the Server object in which to fill in 
  *                   the information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_getServerInfo(JNIEnv * env, jclass cls,
-                                          jint cellHandle, jstring jname,
-                                          jobject server)
-{
-    char *name;
-    afs_status_t ast;
-    afs_serverEntry_t servEntry;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_getServerInfo (JNIEnv *env, jclass cls, 
+                                              jlong cellHandle, jstring jname, 
+                                              jobject server) {
 
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLSERVER);
-       return;
+  const char *name;
+  afs_status_t ast;
+  afs_serverEntry_t servEntry;
+
+  if( jname != NULL ) {
+    name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
+  } else {
+    name = NULL;
+  }
 
-    // get the server entry
-    if (!afsclient_AFSServerGet((void *)cellHandle, name, &servEntry, &ast)) {
-       throwAFSException(env, ast);
+  // get the server entry
+  if ( !afsclient_AFSServerGet( (void *) cellHandle, name, 
+                               &servEntry, &ast ) ) {
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
     }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  fillServerInfo( env, cellHandle, server, servEntry );
 
-    fillServerInfo(env, cellHandle, server, servEntry);
+  if( name != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
 
-    free(name);
 }
 
 /**
@@ -238,32 +258,30 @@ Java_org_openafs_jafs_Server_getServerInfo(JNIEnv * env, jclass cls,
  *                      partitions belong
  * returns total number of partitions
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getPartitionCount(JNIEnv * env, jclass cls,
-                                              jint cellHandle,
-                                              jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    vos_partitionEntry_t partEntry;
-    int i = 0;
-
-    if (!vos_PartitionGetBegin
-       ((void *)cellHandle, (void *)serverHandle, NULL, &iterationId,
-        &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
-
-    while (vos_PartitionGetNext((void *)iterationId, &partEntry, &ast))
-       i++;
-
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
-
-    return i;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getPartitionCount (JNIEnv *env, jclass cls, 
+                                                  jlong cellHandle, 
+                                                  jlong serverHandle) {
+
+  afs_status_t ast;
+  void *iterationId;
+  vos_partitionEntry_t partEntry;
+  int i = 0;
+
+  if( !vos_PartitionGetBegin( (void *) cellHandle, (void *) serverHandle, 
+                             NULL, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
+
+  while ( vos_PartitionGetNext( (void *) iterationId, &partEntry, &ast ) ) i++;
+
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
+
+  return i;
 }
 
 /**
@@ -278,22 +296,21 @@ Java_org_openafs_jafs_Server_getPartitionCount(JNIEnv * env, jclass cls,
  *                      partitions belong
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getPartitionsBegin(JNIEnv * env, jclass cls,
-                                               jint cellHandle,
-                                               jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Server_getPartitionsBegin (JNIEnv *env, jclass cls, 
+                                                   jlong cellHandle, 
+                                                   jlong serverHandle) {
 
-    if (!vos_PartitionGetBegin
-       ((void *)cellHandle, (void *)serverHandle, NULL, &iterationId,
-        &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  void *iterationId;
 
-    return (jint) iterationId;
+  if( !vos_PartitionGetBegin( (void *) cellHandle, (void *) serverHandle, 
+                             NULL, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
 }
 
@@ -306,25 +323,26 @@ Java_org_openafs_jafs_Server_getPartitionsBegin(JNIEnv * env, jclass cls,
  * iterationId   the iteration ID of this iteration
  * returns the name of the next partition of the server
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Server_getPartitionsNextString(JNIEnv * env, jclass cls,
-                                                    jint iterationId)
-{
-    afs_status_t ast;
-    jstring jpartition;
-    vos_partitionEntry_t partEntry;
-
-    if (!vos_PartitionGetNext((void *)iterationId, &partEntry, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return;
-       }
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Server_getPartitionsNextString (JNIEnv *env, 
+                                                        jclass cls, 
+                                                        jlong iterationId) {
+
+  afs_status_t ast;
+  jstring jpartition;
+  vos_partitionEntry_t partEntry;
+
+  if( !vos_PartitionGetNext( (void *) iterationId, &partEntry, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
     }
+  }
 
-    jpartition = (*env)->NewStringUTF(env, partEntry.name);
-    return jpartition;
+  jpartition = (*env)->NewStringUTF(env, partEntry.name);
+  return jpartition;
 
 }
 
@@ -339,34 +357,34 @@ Java_org_openafs_jafs_Server_getPartitionsNextString(JNIEnv * env, jclass cls,
  *                       values of the next partition
  * returns 0 if there are no more servers, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getPartitionsNext(JNIEnv * env, jclass cls,
-                                              jint iterationId,
-                                              jobject jpartitionObject)
-{
-    afs_status_t ast;
-    vos_partitionEntry_t partEntry;
-
-    if (!vos_PartitionGetNext((void *)iterationId, &partEntry, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getPartitionsNext (JNIEnv *env, jclass cls, 
+                                                  jlong iterationId, 
+                                                  jobject jpartitionObject) {
+    
+  afs_status_t ast;
+  vos_partitionEntry_t partEntry;
+
+  if( !vos_PartitionGetNext( (void *) iterationId, &partEntry, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    fillPartitionInfo(env, jpartitionObject, partEntry);
-
-    // get the class fields if need be
-    if (partitionCls == 0) {
-       internal_getPartitionClass(env, jpartitionObject);
-    }
-    (*env)->SetBooleanField(env, jpartitionObject, partition_cachedInfoField,
-                           TRUE);
+  fillPartitionInfo( env, jpartitionObject, partEntry );
 
+  // get the class fields if need be
+  if( partitionCls == 0 ) {
+    internal_getPartitionClass( env, jpartitionObject );
+  }
+  (*env)->SetBooleanField( env, jpartitionObject, partition_cachedInfoField, 
+                          TRUE );
 
-    return 1;
+    
+  return 1;
 
 }
 
@@ -377,16 +395,16 @@ Java_org_openafs_jafs_Server_getPartitionsNext(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_getPartitionsDone(JNIEnv * env, jclass cls,
-                                              jint iterationId)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_getPartitionsDone (JNIEnv *env, jclass cls, 
+                                                  jlong iterationId) {
 
-    if (!vos_PartitionGetDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+
+  if( !vos_PartitionGetDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
 }
 
@@ -399,29 +417,35 @@ Java_org_openafs_jafs_Server_getPartitionsDone(JNIEnv * env, jclass cls,
  *                      partitions belong
  * jnewAdmin   the name of the admin to add to the list
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_addBosAdmin(JNIEnv * env, jclass cls,
-                                        jint serverHandle, jstring jnewAdmin)
-{
-    afs_status_t ast;
-    char *newAdmin;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_addBosAdmin (JNIEnv *env, jclass cls, 
+                                            jlong serverHandle, 
+                                            jstring jnewAdmin) {
 
-    if (jnewAdmin != NULL) {
-       newAdmin = getNativeString(env, jnewAdmin);
-       if (newAdmin == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLUSER);
-       return;
+  afs_status_t ast;
+  const char *newAdmin;
+
+  if( jnewAdmin != NULL ) {
+    newAdmin = (*env)->GetStringUTFChars(env, jnewAdmin, 0);
+    if( !newAdmin ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
+  } else {
+    newAdmin = NULL;
+  }
 
-    if (!bos_AdminCreate((void *)serverHandle, newAdmin, &ast)) {
-       throwAFSException(env, ast);
+  if( !bos_AdminCreate( (void *) serverHandle, newAdmin, &ast ) ) {
+    if( newAdmin != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jnewAdmin, newAdmin);
     }
+    throwAFSException( env, ast );
+    return;
+  }
 
-    free(newAdmin);
+  if( newAdmin != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jnewAdmin, newAdmin);
+  }
 
 }
 
@@ -435,30 +459,36 @@ Java_org_openafs_jafs_Server_addBosAdmin(JNIEnv * env, jclass cls,
  *                      partitions belong
  * joldAdmin   the name of the admin to remove from the list
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_removeBosAdmin(JNIEnv * env, jclass cls,
-                                           jint serverHandle,
-                                           jstring joldAdmin)
-{
-    afs_status_t ast;
-    char *oldAdmin;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_removeBosAdmin (JNIEnv *env, jclass cls, 
+                                               jlong serverHandle, 
+                                               jstring joldAdmin) {
 
-    if (joldAdmin != NULL) {
-       oldAdmin = getNativeString(env, joldAdmin);
-       if (oldAdmin == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLUSER);
-       return;
+  afs_status_t ast;
+  const char *oldAdmin;
+
+  if( joldAdmin != NULL ) {
+    oldAdmin = (*env)->GetStringUTFChars(env, joldAdmin, 0);
+    if( !oldAdmin ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
+  } else {
+    oldAdmin = NULL;
+  }
 
-    if (!bos_AdminDelete((void *)serverHandle, oldAdmin, &ast)) {
-       throwAFSException(env, ast);
+  if( !bos_AdminDelete( (void *) serverHandle, oldAdmin, &ast ) ) {
+    if( oldAdmin != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, joldAdmin, oldAdmin);
     }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( oldAdmin != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, joldAdmin, oldAdmin);
+  }
 
-    free(oldAdmin);
 }
 
 /**
@@ -471,39 +501,38 @@ Java_org_openafs_jafs_Server_removeBosAdmin(JNIEnv * env, jclass cls,
  *                      BOS admins belong
  * returns total number of BOS administrators
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getBosAdminCount(JNIEnv * env, jclass cls,
-                                             jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    char *admin;
-    jstring jadmin;
-    int i = 0;
-
-    if (!bos_AdminGetBegin((void *)serverHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getBosAdminCount (JNIEnv *env, jclass cls, 
+                                                 jlong serverHandle) {
 
-    admin = (char *)malloc(sizeof(char) * BOS_MAX_NAME_LEN);
+  afs_status_t ast;
+  void *iterationId;
+  char *admin;
+  jstring jadmin;
+  int i = 0;
 
-    if (!admin) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return -1;
-    }
+  if( !bos_AdminGetBegin( (void *) serverHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    while (bos_AdminGetNext((void *)iterationId, admin, &ast))
-       i++;
+  admin = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN);
 
-    free(admin);
+  if( !admin ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return -1;
+  }
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  while ( bos_AdminGetNext( (void *) iterationId, admin, &ast ) ) i++;
+
+  free(admin);
 
-    return i;
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
+
+  return i;
 }
 
 /**
@@ -517,19 +546,20 @@ Java_org_openafs_jafs_Server_getBosAdminCount(JNIEnv * env, jclass cls,
  *                      partitions belong
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getBosAdminsBegin(JNIEnv * env, jclass cls,
-                                              jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Server_getBosAdminsBegin (JNIEnv *env, jclass cls, 
+                                                  jlong serverHandle) {
 
-    if (!bos_AdminGetBegin((void *)serverHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  void *iterationId;
+
+  if( !bos_AdminGetBegin( (void *) serverHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -541,33 +571,33 @@ Java_org_openafs_jafs_Server_getBosAdminsBegin(JNIEnv * env, jclass cls,
  * iterationId   the iteration ID of this iteration
  * returns the name of the next admin of the server
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Server_getBosAdminsNextString(JNIEnv * env, jclass cls,
-                                                   jint iterationId)
-{
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Server_getBosAdminsNextString (JNIEnv *env, 
+                                                       jclass cls, 
+                                                       jlong iterationId) {
 
-    afs_status_t ast;
-    jstring jadmin;
-    char *admin = (char *)malloc(sizeof(char) * BOS_MAX_NAME_LEN);
+  afs_status_t ast;
+  jstring jadmin;
+  char *admin = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
 
-    if (!admin) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
+  if( !admin ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
 
-    if (!bos_AdminGetNext((void *)iterationId, admin, &ast)) {
-       free(admin);
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return;
-       }
+  if( !bos_AdminGetNext( (void *) iterationId, admin, &ast ) ) {
+    free(admin);
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
     }
+  }
 
-    jadmin = (*env)->NewStringUTF(env, admin);
-    free(admin);
-    return jadmin;
+  jadmin = (*env)->NewStringUTF(env, admin);
+  free(admin);
+  return jadmin;
 
 }
 
@@ -582,46 +612,46 @@ Java_org_openafs_jafs_Server_getBosAdminsNextString(JNIEnv * env, jclass cls,
  * juserObject   the user object in which to fill the values of this admin
  * returns 0 if no more admins, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getBosAdminsNext(JNIEnv * env, jclass cls,
-                                             jint cellHandle,
-                                             jint iterationId,
-                                             jobject juserObject)
-{
-    afs_status_t ast;
-    char *admin;
-    jstring jadmin;
-
-    admin = (char *)malloc(sizeof(char) * BOS_MAX_NAME_LEN);
-
-    if (!admin) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getBosAdminsNext (JNIEnv *env, jclass cls, 
+                                                 jlong cellHandle, 
+                                                 jlong iterationId, 
+                                                 jobject juserObject ) {
+    
+  afs_status_t ast;
+  char *admin;
+  jstring jadmin;
+
+  admin = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN);
+
+  if( !admin ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( !bos_AdminGetNext( (void *) iterationId, admin, &ast ) ) {
+    free( admin );
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    if (!bos_AdminGetNext((void *)iterationId, admin, &ast)) {
-       free(admin);
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
-    }
+  jadmin = (*env)->NewStringUTF(env, admin);
 
-    jadmin = (*env)->NewStringUTF(env, admin);
+  if( userCls == 0 ) {
+    internal_getUserClass( env, juserObject );
+  }
 
-    if (userCls == 0) {
-       internal_getUserClass(env, juserObject);
-    }
+  (*env)->SetObjectField(env, juserObject, user_nameField, jadmin);
 
-    (*env)->SetObjectField(env, juserObject, user_nameField, jadmin);
+  getUserInfoChar( env, cellHandle, admin, juserObject );
+  (*env)->SetBooleanField( env, juserObject, user_cachedInfoField, TRUE );
 
-    getUserInfoChar(env, cellHandle, admin, juserObject);
-    (*env)->SetBooleanField(env, juserObject, user_cachedInfoField, TRUE);
-
-    free(admin);
-    return 1;
+  free( admin );
+  return 1;
 
 }
 
@@ -632,16 +662,17 @@ Java_org_openafs_jafs_Server_getBosAdminsNext(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_getBosAdminsDone(JNIEnv * env, jclass cls,
-                                             jint iterationId)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_getBosAdminsDone (JNIEnv *env, jclass cls, 
+                                                 jlong iterationId) {
+
+  afs_status_t ast;
+
+  if( !bos_AdminGetDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!bos_AdminGetDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -654,29 +685,28 @@ Java_org_openafs_jafs_Server_getBosAdminsDone(JNIEnv * env, jclass cls,
  *                      keys belong
  * returns total number of keys
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getKeyCount(JNIEnv * env, jclass cls,
-                                        jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    bos_KeyInfo_t keyEntry;
-    int i = 0;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getKeyCount (JNIEnv *env, jclass cls, 
+                                            jlong serverHandle) {
 
-    if (!bos_KeyGetBegin((void *)serverHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  afs_status_t ast;
+  void *iterationId;
+  bos_KeyInfo_t keyEntry;
+  int i = 0;
 
-    while (bos_KeyGetNext((void *)iterationId, &keyEntry, &ast))
-       i++;
+  if( !bos_KeyGetBegin( (void *) serverHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  while ( bos_KeyGetNext( (void *) iterationId, &keyEntry, &ast ) ) i++;
+
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 /**
@@ -689,19 +719,20 @@ Java_org_openafs_jafs_Server_getKeyCount(JNIEnv * env, jclass cls,
  * serverHandle  the bos handle of the server to which the keys belong
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getKeysBegin(JNIEnv * env, jclass cls,
-                                         jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Server_getKeysBegin (JNIEnv *env, jclass cls, 
+                                             jlong serverHandle) {
 
-    if (!bos_KeyGetBegin((void *)serverHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  void *iterationId;
+
+  if( !bos_KeyGetBegin( (void *) serverHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -715,33 +746,34 @@ Java_org_openafs_jafs_Server_getKeysBegin(JNIEnv * env, jclass cls,
  *                 properties of the next key.
  * returns 0 if there are no more keys, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getKeysNext(JNIEnv * env, jclass cls,
-                                        jint iterationId, jobject jkeyObject)
-{
-
-    afs_status_t ast;
-    bos_KeyInfo_t keyEntry;
-
-    if (!bos_KeyGetNext((void *)iterationId, &keyEntry, &ast)) {
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getKeysNext (JNIEnv *env, jclass cls, 
+                                            jlong iterationId, 
+                                            jobject jkeyObject) {
+    
+  afs_status_t ast;
+  bos_KeyInfo_t keyEntry;
+
+  if( !bos_KeyGetNext( (void *) iterationId, &keyEntry, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    fillKeyInfo(env, jkeyObject, keyEntry);
+  fillKeyInfo( env, jkeyObject, keyEntry );
 
-    // get the class fields if need be
-    if (keyCls == 0) {
-       internal_getKeyClass(env, jkeyObject);
-    }
+  // get the class fields if need be
+  if( keyCls == 0 ) {
+    internal_getKeyClass( env, jkeyObject );
+  }
+
+  (*env)->SetBooleanField( env, jkeyObject, key_cachedInfoField, TRUE );
 
-    (*env)->SetBooleanField(env, jkeyObject, key_cachedInfoField, TRUE);
+  return 1;
 
-    return 1;
 }
 
 /**
@@ -751,16 +783,17 @@ Java_org_openafs_jafs_Server_getKeysNext(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_getKeysDone(JNIEnv * env, jclass cls,
-                                        jint iterationId)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_getKeysDone (JNIEnv *env, jclass cls, 
+                                            jlong iterationId) {
+
+  afs_status_t ast;
+
+  if( !bos_KeyGetDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!bos_KeyGetDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -773,39 +806,38 @@ Java_org_openafs_jafs_Server_getKeysDone(JNIEnv * env, jclass cls,
  *                      processes belong
  * returns total number of processes
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getProcessCount(JNIEnv * env, jclass cls,
-                                            jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
-    char *process;
-    jstring jprocess;
-    int i = 0;
-
-    if (!bos_ProcessNameGetBegin((void *)serverHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getProcessCount (JNIEnv *env, jclass cls, 
+                                                jlong serverHandle) {
 
-    process = (char *)malloc(sizeof(char) * BOS_MAX_NAME_LEN);
+  afs_status_t ast;
+  void *iterationId;
+  char *process;
+  jstring jprocess;
+  int i = 0;
 
-    if (!process) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return -1;
-    }
+  if( !bos_ProcessNameGetBegin( (void *) serverHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    while (bos_ProcessNameGetNext((void *)iterationId, process, &ast))
-       i++;
+  process = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
 
-    free(process);
+  if( !process ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return -1;
+  }
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  while ( bos_ProcessNameGetNext( (void *) iterationId, process, &ast ) ) i++;
+
+  free( process );
+
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 /**
@@ -819,19 +851,20 @@ Java_org_openafs_jafs_Server_getProcessCount(JNIEnv * env, jclass cls,
  *                      processes belong
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getProcessesBegin(JNIEnv * env, jclass cls,
-                                              jint serverHandle)
-{
-    afs_status_t ast;
-    void *iterationId;
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_Server_getProcessesBegin (JNIEnv *env, jclass cls, 
+                                                  jlong serverHandle) {
 
-    if (!bos_ProcessNameGetBegin((void *)serverHandle, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+  void *iterationId;
+
+  if( !bos_ProcessNameGetBegin( (void *) serverHandle, &iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -843,32 +876,34 @@ Java_org_openafs_jafs_Server_getProcessesBegin(JNIEnv * env, jclass cls,
  * iterationId   the iteration ID of this iteration
  * returns the name of the next process of the cell
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Server_getProcessesNextString(JNIEnv * env, jclass cls,
-                                                   jint iterationId)
-{
-    afs_status_t ast;
-    jstring jprocess;
-    char *process = (char *)malloc(sizeof(char) * BOS_MAX_NAME_LEN);
-
-    if (!process) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Server_getProcessesNextString (JNIEnv *env, 
+                                                       jclass cls, 
+                                                       jlong iterationId) {
+
+  afs_status_t ast;
+  jstring jprocess;
+  char *process = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
+
+  if( !process ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( !bos_ProcessNameGetNext( (void *) iterationId, process, &ast ) ) {
+    free( process );
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
     }
+  }
 
-    if (!bos_ProcessNameGetNext((void *)iterationId, process, &ast)) {
-       free(process);
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return;
-       }
-    }
+  jprocess = (*env)->NewStringUTF(env, process);
+  free( process );
+  return jprocess;
 
-    jprocess = (*env)->NewStringUTF(env, process);
-    free(process);
-    return jprocess;
 }
 
 /**
@@ -883,45 +918,47 @@ Java_org_openafs_jafs_Server_getProcessesNextString(JNIEnv * env, jclass cls,
  *                          values of the next process
  * returns 0 if there are no more processes, != otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Server_getProcessesNext(JNIEnv * env, jclass cls,
-                                             jint serverHandle,
-                                             jint iterationId,
-                                             jobject jprocessObject)
-{
-    afs_status_t ast;
-    char *process = (char *)malloc(sizeof(char) * BOS_MAX_NAME_LEN);
-    jstring jprocess;
-
-    if (!process) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Server_getProcessesNext (JNIEnv *env, jclass cls, 
+                                                 jlong serverHandle, 
+                                                 jlong iterationId, 
+                                                 jobject jprocessObject) {
+    
+  afs_status_t ast;
+  char *process = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
+  jstring jprocess;
+
+  if( !process ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( !bos_ProcessNameGetNext( (void *) iterationId, process, &ast ) ) {
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      free( process );
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    if (!bos_ProcessNameGetNext((void *)iterationId, process, &ast)) {
-       free(process);
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
-    }
-    // get the class fields if need be
-    if (processCls == 0) {
-       internal_getProcessClass(env, jprocessObject);
-    }
+  // get the class fields if need be
+  if( processCls == 0 ) {
+    internal_getProcessClass( env, jprocessObject );
+  }
 
-    jprocess = (*env)->NewStringUTF(env, process);
-    (*env)->SetObjectField(env, jprocessObject, process_nameField, jprocess);
+  jprocess = (*env)->NewStringUTF(env, process);
+  (*env)->SetObjectField(env, jprocessObject, process_nameField, jprocess);
 
-    getProcessInfoChar(env, (void *)serverHandle, process, jprocessObject);
+  getProcessInfoChar( env, (void *) serverHandle, process, jprocessObject );
 
-    (*env)->SetBooleanField(env, jprocessObject, process_cachedInfoField,
-                           TRUE);
+  (*env)->SetBooleanField( env, jprocessObject, 
+                          process_cachedInfoField, TRUE );
+
+  free( process );
+  return 1;
 
-    free(process);
-    return 1;
 }
 
 /**
@@ -931,16 +968,17 @@ Java_org_openafs_jafs_Server_getProcessesNext(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_getProcessesDone(JNIEnv * env, jclass cls,
-                                             jint iterationId)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_getProcessesDone (JNIEnv *env, jclass cls, 
+                                                 jlong iterationId) {
+
+  afs_status_t ast;
+
+  if( !bos_ProcessNameGetDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!bos_ProcessNameGetDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -975,132 +1013,152 @@ Java_org_openafs_jafs_Server_getProcessesDone(JNIEnv * env, jclass cls,
  *                          one block at a time and skip badly damaged 
  *                          blocks.  Use if partition has disk errors
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_salvage(JNIEnv * env, jclass cls,
-                                    jint cellHandle, jint serverHandle,
-                                    jstring jpartName, jstring jvolName,
-                                    jint numSalvagers, jstring jtempDir,
-                                    jstring jlogFile,
-                                    jboolean inspectAllVolumes,
-                                    jboolean removeBadlyDamaged,
-                                    jboolean writeInodes,
-                                    jboolean writeRootInodes,
-                                    jboolean forceDirectory,
-                                    jboolean forceBlockReads)
-{
-    afs_status_t ast;
-    char *partName;
-    char *volName;
-    char *tempDir;
-    char *logFile;
-    vos_force_t force;
-    bos_SalvageDamagedVolumes_t sdv;
-    bos_WriteInodes_t wi;
-    bos_WriteRootInodes_t wri;
-    bos_ForceDirectory_t forceD;
-    bos_ForceBlockRead_t forceBR;
-
-    // convert strings
-    if (jpartName != NULL) {
-       partName = getNativeString(env, jpartName);
-       if (!partName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       partName = NULL;
-    }
-
-    if (jvolName != NULL) {
-       volName = getNativeString(env, jvolName);
-       if (!volName) {
-           if (partName != NULL)
-               free(partName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       volName = NULL;
-    }
-
-    if (jtempDir != NULL) {
-       tempDir = getNativeString(env, jtempDir);
-       if (!tempDir) {
-           if (partName != NULL)
-               free(partName);
-           if (volName != NULL)
-               free(volName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       tempDir = NULL;
-    }
-
-    if (jlogFile != NULL) {
-       logFile = getNativeString(env, jlogFile);
-       if (!logFile) {
-           if (partName != NULL)
-               free(partName);
-           if (volName != NULL)
-               free(volName);
-           if (tempDir != NULL)
-               free(tempDir);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       logFile = NULL;
-    }
-
-    // deal with booleans
-    if (inspectAllVolumes) {
-       force = VOS_FORCE;
-    } else {
-       force = VOS_NORMAL;
-    }
-    if (removeBadlyDamaged) {
-       sdv = BOS_DONT_SALVAGE_DAMAGED_VOLUMES;
-    } else {
-       sdv = BOS_SALVAGE_DAMAGED_VOLUMES;
-    }
-    if (writeInodes) {
-       wi = BOS_SALVAGE_WRITE_INODES;
-    } else {
-       wi = BOS_SALVAGE_DONT_WRITE_INODES;
-    }
-    if (writeRootInodes) {
-       wri = BOS_SALVAGE_WRITE_ROOT_INODES;
-    } else {
-       wri = BOS_SALVAGE_DONT_WRITE_ROOT_INODES;
-    }
-    if (forceDirectory) {
-       forceD = BOS_SALVAGE_FORCE_DIRECTORIES;
-    } else {
-       forceD = BOS_SALVAGE_DONT_FORCE_DIRECTORIES;
-    }
-    if (forceBlockReads) {
-       forceBR = BOS_SALVAGE_FORCE_BLOCK_READS;
-    } else {
-       forceBR = BOS_SALVAGE_DONT_FORCE_BLOCK_READS;
-    }
-
-    //salvage!
-    if (!bos_Salvage
-       ((void *)cellHandle, (void *)serverHandle, partName, volName,
-        (int)numSalvagers, tempDir, logFile, force, sdv, wi, wri, forceD,
-        forceBR, &ast)) {
-       throwAFSException(env, ast);
-    }
-    // release strings
-    if (partName != NULL)
-       free(partName);
-    if (volName != NULL)
-       free(volName);
-    if (tempDir != NULL)
-       free(tempDir);
-    if (logFile != NULL)
-       free(logFile);
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_salvage (JNIEnv *env, jclass cls, 
+                                        jlong cellHandle, jlong serverHandle, 
+                                        jstring jpartName, jstring jvolName, 
+                                        jint numSalvagers, jstring jtempDir, 
+                                        jstring jlogFile, 
+                                        jboolean inspectAllVolumes, 
+                                        jboolean removeBadlyDamaged, 
+                                        jboolean writeInodes, 
+                                        jboolean writeRootInodes, 
+                                        jboolean forceDirectory, 
+                                        jboolean forceBlockReads) {
+
+  afs_status_t ast;
+  const char *partName;
+  const char *volName;
+  const char *tempDir;
+  const char *logFile;
+  vos_force_t force;
+  bos_SalvageDamagedVolumes_t sdv;
+  bos_WriteInodes_t wi;
+  bos_WriteRootInodes_t wri;
+  bos_ForceDirectory_t forceD;
+  bos_ForceBlockRead_t forceBR;
+  
+  // convert strings
+  if( jpartName != NULL ) {
+    partName = (*env)->GetStringUTFChars(env, jpartName, 0);    
+    if( !partName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    partName = NULL;
+  }
+  if( jvolName != NULL ) {
+    volName = (*env)->GetStringUTFChars(env, jvolName, 0);    
+    if( !volName ) {
+      if( partName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jpartName, partName);    
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    volName = NULL;
+  }
+  if( jtempDir != NULL ) {
+    tempDir = (*env)->GetStringUTFChars(env, jtempDir, 0);    
+    if( !tempDir ) {
+      if( partName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jpartName, partName);    
+      }
+      if( volName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jvolName, volName);    
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    tempDir = NULL;
+  }
+  if( jlogFile != NULL ) {
+    logFile = (*env)->GetStringUTFChars(env, jlogFile, 0);    
+    if( !logFile ) {
+      if( partName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jpartName, partName);    
+      }
+      if( volName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jvolName, volName);    
+      }
+      if( tempDir != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jtempDir, tempDir);    
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    logFile = NULL;
+  }
+
+  // deal with booleans
+  if( inspectAllVolumes ) {
+    force = VOS_FORCE;
+  } else {
+    force = VOS_NORMAL;
+  }
+  if( removeBadlyDamaged ) {
+    sdv = BOS_DONT_SALVAGE_DAMAGED_VOLUMES;
+  } else {
+    sdv = BOS_SALVAGE_DAMAGED_VOLUMES;
+  }
+  if( writeInodes ) {
+    wi = BOS_SALVAGE_WRITE_INODES;
+  } else {
+    wi = BOS_SALVAGE_DONT_WRITE_INODES;
+  }
+  if( writeRootInodes ) {
+    wri = BOS_SALVAGE_WRITE_ROOT_INODES;
+  } else {
+    wri = BOS_SALVAGE_DONT_WRITE_ROOT_INODES;
+  }
+  if( forceDirectory ) {
+    forceD = BOS_SALVAGE_FORCE_DIRECTORIES;
+  } else {
+    forceD = BOS_SALVAGE_DONT_FORCE_DIRECTORIES;
+  }
+  if( forceBlockReads ) {
+    forceBR = BOS_SALVAGE_FORCE_BLOCK_READS;
+  } else {
+    forceBR = BOS_SALVAGE_DONT_FORCE_BLOCK_READS;
+  }
+
+  //salvage!
+  if( !bos_Salvage( (void *) cellHandle, (void *) serverHandle, partName, 
+                   volName, (int) numSalvagers, tempDir, logFile, force, sdv, 
+                   wi, wri, forceD, forceBR, &ast ) ) {
+    if( partName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jpartName, partName);    
+    }
+    if( volName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jvolName, volName);    
+    }
+    if( tempDir != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jtempDir, tempDir);    
+    }
+    if( logFile != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jlogFile, logFile);    
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  // release strings
+  if( partName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jpartName, partName);    
+  }
+  if( volName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jvolName, volName);    
+  }
+  if( tempDir != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jtempDir, tempDir);    
+  }
+  if( logFile != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jlogFile, logFile);    
+  }
 
 }
 
@@ -1118,67 +1176,67 @@ Java_org_openafs_jafs_Server_salvage(JNIEnv * env, jclass cls,
  * execTime   the ExecutableTime object, in which 
  *                   to fill the restart time fields
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_getRestartTime(JNIEnv * env, jclass cls,
-                                           jint serverHandle, jint jtype,
-                                           jobject exectime)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_getRestartTime
+  (JNIEnv *env, jclass cls, jlong serverHandle, jint jtype, jobject exectime)
 {
-    afs_status_t ast;
-    bos_Restart_t type;
-    bos_RestartTime_t time;
-    jfieldID hourField;
-    jfieldID minField;
-    jfieldID secField;
-    jfieldID dayField;
-    jfieldID neverField;
-    jfieldID nowField;
-
-    // get the class fields if need be
-    if (exectimeCls == 0) {
-       internal_getExecTimeClass(env, exectime);
-    }
-
-    if (jtype == org_openafs_jafs_Server_RESTART_BINARY) {
-       type = BOS_RESTART_DAILY;
-    } else {
-       type = BOS_RESTART_WEEKLY;
-    }
-
-    hourField = exectime_HourField;
-    minField = exectime_MinField;
-    secField = exectime_SecField;
-    dayField = exectime_DayField;
-    neverField = exectime_NeverField;
-    nowField = exectime_NowField;
-
-    if (!bos_ExecutableRestartTimeGet
-       ((void *)serverHandle, type, &time, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
-    // set now
-    (*env)->SetBooleanField(env, exectime, nowField,
-                           (time.mask & BOS_RESTART_TIME_NOW));
-
-    // set never
-    (*env)->SetBooleanField(env, exectime, neverField,
-                           (time.mask & BOS_RESTART_TIME_NEVER));
-
-    // set hour
-    (*env)->SetShortField(env, exectime, hourField, time.hour);
-
-    // set minute
-    (*env)->SetShortField(env, exectime, minField, time.min);
-
-    // set second
-    (*env)->SetShortField(env, exectime, secField, time.sec);
-
-    // set day
-    if (time.mask & BOS_RESTART_TIME_DAY) {
-       (*env)->SetShortField(env, exectime, dayField, time.day);
-    } else {
-       (*env)->SetShortField(env, exectime, dayField, (jshort) - 1);
-    }
+  afs_status_t ast;
+  bos_Restart_t type;
+  bos_RestartTime_t time;
+  jfieldID hourField;
+  jfieldID minField;
+  jfieldID secField;
+  jfieldID dayField;
+  jfieldID neverField;
+  jfieldID nowField;
+
+  // get the class fields if need be
+  if( exectimeCls == 0 ) {
+    internal_getExecTimeClass( env, exectime );
+  }
+
+  if( jtype == org_openafs_jafs_Server_RESTART_BINARY ) {
+    type = BOS_RESTART_DAILY;
+  } else {
+    type = BOS_RESTART_WEEKLY;
+  }
+
+  hourField  = exectime_HourField;
+  minField   = exectime_MinField;
+  secField   = exectime_SecField;
+  dayField   = exectime_DayField;
+  neverField = exectime_NeverField;
+  nowField   = exectime_NowField;
+
+  if( !bos_ExecutableRestartTimeGet( (void *) serverHandle, type, 
+                                    &time, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+  
+  // set now
+  (*env)->SetBooleanField(env, exectime, nowField, 
+                         (time.mask & BOS_RESTART_TIME_NOW) );
+  
+  // set never
+  (*env)->SetBooleanField(env, exectime, neverField, 
+                         (time.mask & BOS_RESTART_TIME_NEVER) );
+
+  // set hour
+  (*env)->SetShortField(env, exectime, hourField, time.hour );
+
+  // set minute
+  (*env)->SetShortField(env, exectime, minField, time.min );
+
+  // set second
+  (*env)->SetShortField(env, exectime, secField, time.sec );
+
+  // set day
+  if( time.mask & BOS_RESTART_TIME_DAY ) {
+    (*env)->SetShortField(env, exectime, dayField, time.day );
+  } else {
+    (*env)->SetShortField(env, exectime, dayField, (jshort) -1 );
+  }
 
 }
 
@@ -1195,111 +1253,114 @@ Java_org_openafs_jafs_Server_getRestartTime(JNIEnv * env, jclass cls,
  * executableTime   the ExecutableTime object containing the 
  *                         desired information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_setRestartTime(JNIEnv * env, jclass cls,
-                                           jint serverHandle, jint jtype,
-                                           jobject exectime)
-{
-    afs_status_t ast;
-    bos_Restart_t type;
-    bos_RestartTime_t time;
-    jboolean doHour;
-    jboolean doMinute;
-    jboolean doSecond;
-    jboolean doDay;
-    jboolean doNever;
-    jboolean doNow;
-    jshort hour;
-    jshort minute;
-    jshort second;
-    jshort day;
-    jfieldID hourField;
-    jfieldID minField;
-    jfieldID secField;
-    jfieldID dayField;
-    jfieldID neverField;
-    jfieldID nowField;
-
-    // get the class fields if need be
-    if (exectimeCls == 0) {
-       internal_getExecTimeClass(env, exectime);
-    }
-
-    if (jtype == org_openafs_jafs_Server_RESTART_BINARY) {
-       type = BOS_RESTART_DAILY;
-    } else {
-       type = BOS_RESTART_WEEKLY;
-    }
-
-    hourField = exectime_HourField;
-    minField = exectime_MinField;
-    secField = exectime_SecField;
-    dayField = exectime_DayField;
-    neverField = exectime_NeverField;
-    nowField = exectime_NowField;
-
-    hour = (*env)->GetShortField(env, exectime, hourField);
-    if (hour != 0) {
-       doHour = TRUE;
-    } else {
-       doHour = FALSE;
-    }
-    minute = (*env)->GetShortField(env, exectime, minField);
-    if (minute != 0) {
-       doMinute = TRUE;
-    } else {
-       doMinute = FALSE;
-    }
-    second = (*env)->GetShortField(env, exectime, secField);
-    if (second != 0) {
-       doSecond = TRUE;
-    } else {
-       doSecond = FALSE;
-    }
-    day = (*env)->GetShortField(env, exectime, dayField);
-    if (day != -1) {
-       doDay = TRUE;
-    } else {
-       doDay = FALSE;
-    }
-    doNever = (*env)->GetBooleanField(env, exectime, neverField);
-    doNow = (*env)->GetBooleanField(env, exectime, nowField);
-
-    bzero(&time, sizeof(time));
-
-    if (jtype == org_openafs_jafs_Server_RESTART_BINARY) {
-       type = BOS_RESTART_DAILY;
-    } else {
-       type = BOS_RESTART_WEEKLY;
-    }
-
-    if (doHour) {
-       time.mask |= BOS_RESTART_TIME_HOUR;
-    }
-    if (doMinute) {
-       time.mask |= BOS_RESTART_TIME_MINUTE;
-    }
-    if (doSecond) {
-       time.mask |= BOS_RESTART_TIME_SECOND;
-    }
-    if (doDay) {
-       time.mask |= BOS_RESTART_TIME_DAY;
-    }
-    if (doNever) {
-       time.mask |= BOS_RESTART_TIME_NEVER;
-    }
-    if (doNow) {
-       time.mask |= BOS_RESTART_TIME_NOW;
-    }
-
-    time.hour = hour;
-    time.min = minute;
-    time.sec = second;
-    time.day = day;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_setRestartTime (JNIEnv *env, jclass cls, 
+                                               jlong serverHandle, jint jtype, 
+                                               jobject exectime ) {
+
+  afs_status_t ast;
+  bos_Restart_t type;
+  bos_RestartTime_t time;
+  jboolean doHour;
+  jboolean doMinute;
+  jboolean doSecond;
+  jboolean doDay;
+  jboolean doNever;
+  jboolean doNow;  
+  jshort hour;
+  jshort minute;
+  jshort second;
+  jshort day;
+  jfieldID hourField;
+  jfieldID minField;
+  jfieldID secField;
+  jfieldID dayField;
+  jfieldID neverField;
+  jfieldID nowField;
+
+  // get the class fields if need be
+  if( exectimeCls == 0 ) {
+    internal_getExecTimeClass( env, exectime );
+  }
+
+  if( jtype == org_openafs_jafs_Server_RESTART_BINARY ) {
+    type = BOS_RESTART_DAILY;
+  } else {
+    type = BOS_RESTART_WEEKLY;
+  }
+
+  hourField  = exectime_HourField;
+  minField   = exectime_MinField;
+  secField   = exectime_SecField;
+  dayField   = exectime_DayField;
+  neverField = exectime_NeverField;
+  nowField   = exectime_NowField;
+
+  hour = (*env)->GetShortField(env, exectime, hourField );
+  if( hour != 0 ) {
+    doHour = TRUE;
+  } else {
+    doHour = FALSE;
+  }
+  minute = (*env)->GetShortField(env, exectime, minField );
+  if( minute != 0 ) {
+    doMinute = TRUE;
+  } else {
+    doMinute = FALSE;
+  }
+  second = (*env)->GetShortField(env, exectime, secField );
+  if( second != 0 ) {
+    doSecond = TRUE;
+  } else {
+    doSecond = FALSE;
+  }
+  day = (*env)->GetShortField(env, exectime, dayField );
+  if( day != -1 ) {
+    doDay = TRUE;
+  } else {
+    doDay = FALSE;
+  }
+  doNever = (*env)->GetBooleanField(env, exectime, neverField );
+  doNow = (*env)->GetBooleanField(env, exectime, nowField );
+
+  bzero(&time, sizeof(time));
+
+  if( jtype == org_openafs_jafs_Server_RESTART_BINARY ) {
+    type = BOS_RESTART_DAILY;
+  } else {
+    type = BOS_RESTART_WEEKLY;
+  }  
+
+  if( doHour ) {
+    time.mask |= BOS_RESTART_TIME_HOUR;
+  }
+  if( doMinute ) {
+    time.mask |= BOS_RESTART_TIME_MINUTE;
+  }
+  if( doSecond ) {
+    time.mask |= BOS_RESTART_TIME_SECOND;
+  }
+  if( doDay ) {
+    time.mask |= BOS_RESTART_TIME_DAY;
+  }
+  if( doNever ) {
+    time.mask |= BOS_RESTART_TIME_NEVER;
+  }
+  if( doNow ) {
+    time.mask |= BOS_RESTART_TIME_NOW;
+  }
+
+  time.hour = hour;
+  time.min = minute;
+  time.sec = second;
+  time.day = day;
+
+  if( !bos_ExecutableRestartTimeSet( (void *) serverHandle, type, 
+                                    time, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!bos_ExecutableRestartTimeSet((void *)serverHandle, type, time, &ast)) {
-       throwAFSException(env, ast);
-    }
 }
 
 /**
@@ -1311,25 +1372,27 @@ Java_org_openafs_jafs_Server_setRestartTime(JNIEnv * env, jclass cls,
  * serverHandle  the vos handle of the server     
  * partition   the id of the partition to sync, can be -1 to ignore
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_syncServerWithVLDB(JNIEnv * env, jclass cls,
-                                               jint cellHandle,
-                                               jint serverHandle,
-                                               jint partition)
-{
-    afs_status_t ast;
-    int *part;
-
-    if (partition == -1) {
-       part = NULL;
-    } else {
-       part = (int *)&partition;
-    }
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_syncServerWithVLDB (JNIEnv *env, jclass cls, 
+                                                   jlong cellHandle, 
+                                                   jlong serverHandle, 
+                                                   jint partition) {
+
+  afs_status_t ast;
+  int *part;
+
+  if( partition == -1 ) {
+    part = NULL;
+  } else {
+    part = (int *) &partition;
+  }
+
+  if( !vos_ServerSync( (void *) cellHandle, (void *) serverHandle, 
+                      NULL, part, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_ServerSync
-       ((void *)cellHandle, (void *)serverHandle, NULL, part, &ast)) {
-       throwAFSException(env, ast);
-    }
 }
 
 /**
@@ -1342,33 +1405,35 @@ Java_org_openafs_jafs_Server_syncServerWithVLDB(JNIEnv * env, jclass cls,
  * partition   the id of the partition to sync, can be -1 to ignore
  * forceDeletion   whether or not to force the deletion of bad volumes
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_syncVLDBWithServer(JNIEnv * env, jclass cls,
-                                               jint cellHandle,
-                                               jint serverHandle,
-                                               jint partition,
-                                               jboolean forceDeletion)
-{
-    afs_status_t ast;
-    int *part;
-    vos_force_t force;
-
-    if (partition == -1) {
-       part = NULL;
-    } else {
-       part = (int *)&partition;
-    }
-
-    if (forceDeletion) {
-       force = VOS_FORCE;
-    } else {
-       force = VOS_NORMAL;
-    }
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_syncVLDBWithServer (JNIEnv *env, jclass cls, 
+                                                   jlong cellHandle, 
+                                                   jlong serverHandle, 
+                                                   jint partition, 
+                                                   jboolean forceDeletion) {
+
+  afs_status_t ast;
+  int *part;
+  vos_force_t force;
+
+  if( partition == -1 ) {
+    part = NULL;
+  } else {
+    part = (int *) &partition;
+  }
+  
+  if( forceDeletion ) {
+    force = VOS_FORCE;
+  } else {
+    force = VOS_NORMAL;
+  }
+
+  if( !vos_VLDBSync( (void *) cellHandle, (void *) serverHandle, NULL, part, 
+                    force, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VLDBSync
-       ((void *)cellHandle, (void *)serverHandle, NULL, part, force, &ast)) {
-       throwAFSException(env, ast);
-    }
 }
 
 /**
@@ -1379,16 +1444,17 @@ Java_org_openafs_jafs_Server_syncVLDBWithServer(JNIEnv * env, jclass cls,
  * serverHandle  the bos handle of the server to which the 
  *                      processes belong
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_startAllProcesses(JNIEnv * env, jclass cls,
-                                              jint serverHandle)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_startAllProcesses (JNIEnv *env, jclass cls, 
+                                                  jlong serverHandle) {
+
+  afs_status_t ast;
+
+  if( !bos_ProcessAllStart( (void *) serverHandle, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!bos_ProcessAllStart((void *)serverHandle, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -1399,16 +1465,17 @@ Java_org_openafs_jafs_Server_startAllProcesses(JNIEnv * env, jclass cls,
  * serverHandle  the bos handle of the server to which the 
  *                      processes belong
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_stopAllProcesses(JNIEnv * env, jclass cls,
-                                             jint serverHandle)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_stopAllProcesses (JNIEnv *env, jclass cls, 
+                                                 jlong serverHandle) {
+
+  afs_status_t ast;
+
+  if( !bos_ProcessAllStop( (void *) serverHandle, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!bos_ProcessAllStop((void *)serverHandle, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -1420,24 +1487,25 @@ Java_org_openafs_jafs_Server_stopAllProcesses(JNIEnv * env, jclass cls,
  *                      processes belong
  * restartBosServer   whether or not to restart the bos server as well
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_restartAllProcesses(JNIEnv * env, jclass cls,
-                                                jint serverHandle,
-                                                jboolean restartBosServer)
-{
-    afs_status_t ast;
-    bos_RestartBosServer_t rbs;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_restartAllProcesses (JNIEnv *env, jclass cls, 
+                                                    jlong serverHandle, 
+                                                  jboolean restartBosServer) {
+
+  afs_status_t ast;
+  bos_RestartBosServer_t rbs;
+  
+  if( restartBosServer ) {
+    rbs = BOS_RESTART_BOS_SERVER;
+  } else {
+    rbs = BOS_DONT_RESTART_BOS_SERVER;
+  }
+
+  if( !bos_ProcessAllStopAndRestart( (void *) serverHandle, rbs, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (restartBosServer) {
-       rbs = BOS_RESTART_BOS_SERVER;
-    } else {
-       rbs = BOS_DONT_RESTART_BOS_SERVER;
-    }
-
-    if (!bos_ProcessAllStopAndRestart((void *)serverHandle, rbs, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -1450,77 +1518,89 @@ Java_org_openafs_jafs_Server_restartAllProcesses(JNIEnv * env, jclass cls,
  * serverHandle  the bos handle of the server to which the key belongs
  * jlogFile   the full path and name of the desired bos log
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_Server_getLog(JNIEnv * env, jclass cls,
-                                   jint serverHandle, jstring jlogFile)
-{
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_Server_getLog(JNIEnv *env, jclass cls, 
+                                      jlong serverHandle, jstring jlogFile) {
+
     afs_status_t ast;
-    char *logFile;
+    const char *logFile;
     char *logData;
     unsigned long currInLogSize = 1;
     unsigned long currOutLogSize = 0;
     jstring logOut;
 
-    logData = (char *)malloc(sizeof(char) * currInLogSize);
-    if (logData == NULL) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return NULL;
+    if( jlogFile != NULL ) {
+      logFile = (*env)->GetStringUTFChars(env, jlogFile, 0);
+      if( !logFile ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
+    } else {
+      logFile = NULL;
     }
 
-    if (jlogFile != NULL) {
-       logFile = getNativeString(env, jlogFile);
-       if (logFile == NULL) {
-           free(logData);
-           throwAFSException(env, JAFSADMNOMEM);
-           return NULL;
-       }
-    } else {
-       free(logData);
-       throwAFSException(env, JAFSNULLARG);
-       return NULL;
+    logData = (char *) malloc( sizeof(char)*currInLogSize );
+    if( !logData ) {
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
     }
 
     // check how big the log is . . .
-    if (!bos_LogGet
-       ((void *)serverHandle, logFile, &currOutLogSize, logData, &ast)) {
-       // anything but not enough room in buffer
-       if (ast != ADMMOREDATA) {
-           free(logData);
-           free(logFile);
-           throwAFSException(env, ast);
-           return NULL;
+    if( !bos_LogGet( (void *) serverHandle, logFile, 
+                    &currOutLogSize, logData, &ast ) ) {
+      // anything but not enough room in buffer
+      if( ast != ADMMOREDATA ) {
+       free( logData );
+       if( logFile != NULL ) { 
+         (*env)->ReleaseStringUTFChars(env, jlogFile, logFile);
        }
+       throwAFSException( env, ast );
+       return NULL;
+      }
     }
-    // free previous allocation
-    free(logData);
+
+    free( logData );
 
     // increase log size (plus one for terminator)
     currInLogSize = currOutLogSize + 1;
-
     // allocate buffer
-    logData = (char *)malloc(sizeof(char) * currInLogSize);
-    if (logData == NULL) {
-       free(logFile);
-       throwAFSException(env, JAFSADMNOMEM);
-       return NULL;
+    logData = (char *) malloc( sizeof(char)*currInLogSize );
+    if( !logData ) {
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+
+    if( !logData ) {
+      // memory exception
+      if( logFile != NULL ) { 
+         (*env)->ReleaseStringUTFChars(env, jlogFile, logFile);
+      }
+      throwAFSException( env, ast );
+      return NULL;
     }
+
     // get the log for real
-    if (!bos_LogGet
-       ((void *)serverHandle, logFile, &currOutLogSize, logData, &ast)) {
-       free(logData);
-       free(logFile);
-       throwAFSException(env, ast);
+    if( !bos_LogGet( (void *) serverHandle, logFile, &currOutLogSize, 
+                    logData, &ast ) ) {
+       free( logData );
+       if( logFile != NULL ) { 
+         (*env)->ReleaseStringUTFChars(env, jlogFile, logFile);
+       }
+       (*env)->ReleaseStringUTFChars(env, jlogFile, logFile);
+       throwAFSException( env, ast );
        return NULL;
     }
-    // NULL-terminate
+    
     logData[currOutLogSize] == '\0';
 
     logOut = (*env)->NewStringUTF(env, logData);
-
-    free(logData);
-    free(logFile);
-
+    
+    free( logData );
+    if( logFile != NULL ) { 
+      (*env)->ReleaseStringUTFChars(env, jlogFile, logFile);
+    }
     return logOut;
+
 }
 
 
@@ -1532,38 +1612,65 @@ Java_org_openafs_jafs_Server_getLog(JNIEnv * env, jclass cls,
  * serverHandle  the bos handle of the server to which the key belongs
  * jcommand     the text of the commmand to execute
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_executeCommand(JNIEnv * env, jclass cls,
-                                           jint serverHandle,
-                                           jstring jcommand)
-{
-    afs_status_t ast;
-    char *command;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Server_executeCommand (JNIEnv *env, jclass cls, 
+                                               jlong serverHandle, 
+                                               jstring jcommand) {
 
-    if (jcommand != NULL) {
-       command = getNativeString(env, jcommand);
-       if (command == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLARG);
-       return;
+  afs_status_t ast;
+  const char *command;
+
+  if( jcommand != NULL ) {
+    command = (*env)->GetStringUTFChars(env, jcommand, 0);
+    if( !command ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
+  } else {
+    command = NULL;
+  }
 
-    if (!bos_CommandExecute((void *)serverHandle, command, &ast)) {
-       throwAFSException(env, ast);
+  if( !bos_CommandExecute( (void *) serverHandle, command, &ast ) ) {
+    if( command != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jcommand, command);
     }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( command != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jcommand, command);
+  }
 
-    free(command);
 }
 
 // reclaim global memory being used by this portion
 JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Server_reclaimServerMemory(JNIEnv * env, jclass cls)
-{
-    if (serverCls) {
-       (*env)->DeleteGlobalRef(env, serverCls);
-       serverCls = 0;
-    }
+Java_org_openafs_jafs_Server_reclaimServerMemory (JNIEnv *env, jclass cls) {
+
+  if( serverCls ) {
+      (*env)->DeleteGlobalRef(env, serverCls);
+      serverCls = 0;
+  }
+
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index a581948..5e2abf8 100644 (file)
@@ -68,6 +68,7 @@ extern jfieldID user_lockTimeField;
 extern jfieldID user_lockedUntilField;
 
 extern jclass groupCls;
+//extern jfieldID group_cellHandleField;
 extern jfieldID group_nameField;
 extern jfieldID group_cachedInfoField;
 
@@ -80,107 +81,140 @@ extern jfieldID group_cachedInfoField;
  * env      the Java environment
  * cls      the current Java class
  * cellHandle    the handle of the cell to which the user belongs
- * jusername      the name of the user to create
+ * juserName      the name of the user to create
  * jpassword      the password for the new user
  * uid     the user id to assign to the user (0 to have one 
  *                automatically assigned)
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_create(JNIEnv * env, jclass cls, jint cellHandle,
-                                 jstring jusername, jstring jpassword,
-                                 jint uid)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_create
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring juserName, 
+   jstring jpassword, jint uid )
 {
-    afs_status_t ast;
-    char *username;
-    char *password;
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-
-    if (!who) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-    // convert java strings
-    if (jusername != NULL) {
-       username = getNativeString(env, jusername);
-       if (username == NULL) {
-           free(who);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(who);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    if (jpassword != NULL) {
-       password = getNativeString(env, jpassword);
-       if (password == NULL) {
-           free(who);
-           free(username);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(who);
-       free(username);
-       throwAFSException(env, JAFSNULLPASS);
-       return;
-    }
-
-    // make sure the name is within the allowed bounds
-    if (strlen(username) > KAS_MAX_NAME_LEN) {
-       free(who);
-       free(username);
-       free(password);
-       throwAFSException(env, ADMPTSUSERNAMETOOLONG);
-       return;
-    }
-    // make sure name doesn't have ":" in it
-    if (strchr(username, ':') != (int)NULL) {
-       free(who);
-       free(username);
-       free(password);
-       throwAFSException(env, PRBADNAM);
-       return;
-    }
-    // make sure the id isn't negative
-    if (uid < 0) {
-       free(who);
-       free(username);
-       free(password);
-       // use the "bad arg" error code even though it's an ID exception.  
-       // There isn't a bad user ID error code
-       throwAFSException(env, PRBADARG);
-       return;
-    }
-
-    if (username != NULL) {
-       internal_makeKasIdentity(username, who);
-    }
-    // create the kas entry
-    if (!kas_PrincipalCreate((void *)cellHandle, NULL, who, password, &ast)) {
-       free(who);
-       free(username);
-       free(password);
-       throwAFSException(env, ast);
-       return;
-    }
-    // create the pts entry - if there's an error, make sure to delete 
-    // the kas entry 
-    if (!pts_UserCreate((void *)cellHandle, username, (int *)&uid, &ast)) {
-       afs_status_t ast_kd;
-       kas_PrincipalDelete((void *)cellHandle, NULL, who, &ast_kd);
-       free(who);
-       free(username);
-       free(password);
-       throwAFSException(env, ast);
-       return;
-    }
-
+  afs_status_t ast;
+  const char *userName;
+  const char *password;
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );
+  
+  if( !who ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  // convert java strings
+  if( juserName != NULL ) {
+    userName = (*env)->GetStringUTFChars(env, juserName, 0);
+    if( !userName ) {
+      free( who );
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    userName = NULL;
+  }
+  if( jpassword != NULL ) {
+    password = (*env)->GetStringUTFChars(env, jpassword, 0);
+    if( !password ) {
+      free( who );
+      if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    password = NULL;
+  }
+
+  // make sure the name is within the allowed bounds
+  if( userName != NULL && strlen( userName ) > KAS_MAX_NAME_LEN ) {
+    free( who );
+    // release converted java strings
+    if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    if( password != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jpassword, password);
+    }
+    throwAFSException( env, ADMPTSUSERNAMETOOLONG  );
+    return;
+  }
+
+  // make sure name doesn't have ":" in it
+  if( userName != NULL && strchr( userName, ':' ) != (int) NULL ) {
+      free(who);
+      // release converted java strings
+      if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+      }
+      if( password != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jpassword, password);
+      }
+      throwAFSException( env, PRBADNAM );
+      return;
+  }
+
+  // make sure the id isn't negative
+  if( uid < 0 ) {
+      free(who);
+      // release converted java strings
+      if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+      }
+      if( password != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jpassword, password);
+      }
+      // use the "bad arg" error code even though it's an ID exception.  
+      // There isn't a bad user ID error code
+      throwAFSException( env, PRBADARG );
+      return;
+  }
+
+  if( userName != NULL ) {
+    internal_makeKasIdentity( userName, who );
+  }
+
+  // create the kas entry
+  if (!kas_PrincipalCreate( (void *) cellHandle, NULL, who, 
+                           password, &ast ) ) {
     free(who);
-    free(username);
-    free(password);
+    // release converted java strings
+    if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    if( password != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jpassword, password);
+    }
+    throwAFSException( env, ast );
+    return;
+  } 
+
+  // create the pts entry - if there's an error, make sure to delete 
+  // the kas entry 
+  if( !pts_UserCreate( (void *) cellHandle, userName, (int *) &uid, &ast ) ) {
+    afs_status_t ast_kd;
+    kas_PrincipalDelete( (void *) cellHandle, NULL, who, &ast_kd );
+    free( who );
+    // release converted java strings
+    if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    if( password != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jpassword, password);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  free( who );
+  // release converted java strings
+  if( userName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
+  if( password != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jpassword, password);
+  }
+
 }
 
 /**
@@ -191,71 +225,81 @@ Java_org_openafs_jafs_User_create(JNIEnv * env, jclass cls, jint cellHandle,
  * env      the Java environment
  * cls      the current Java class
  * cellHandle    the handle of the cell to which the user belongs
- * jusername      the name of the user to delete
+ * juserName      the name of the user to delete
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_delete(JNIEnv * env, jclass cls, jint cellHandle,
-                                 jstring jusername)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_delete
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring juserName )
 {
-    afs_status_t ast;
-    char *username;
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-    int kas;
-
-    if (!who) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-
-    if (jusername != NULL) {
-       username = getNativeString(env, jusername);
-       if (username == NULL) {
-           free(who);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(who);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    // make sure the name is within the allowed bounds
-    if (strlen(username) > KAS_MAX_NAME_LEN) {
-       free(who);
-       free(username);
-       throwAFSException(env, ADMPTSUSERNAMETOOLONG);
-       return;
-    }
-
-    internal_makeKasIdentity(username, who);
-
-    // delete the kas entry
-    if (!kas_PrincipalDelete((void *)cellHandle, NULL, who, &ast)) {
-       if (ast != KANOENT) {
-           free(who);
-           free(username);
-           throwAFSException(env, ast);
-           return;
-       } else {
-           kas = FALSE;
-       }
-    }
-    //delete the pts entry
-    if (!pts_UserDelete((void *)cellHandle, username, &ast)) {
-       // throw exception if there was no such pts user only if there was 
-       // also no such kas user
-       if ((ast == ADMPTSFAILEDNAMETRANSLATE && !kas)
-           || ast != ADMPTSFAILEDNAMETRANSLATE) {
-           free(who);
-           free(username);
-           throwAFSException(env, ast);
-           return;
-       }
-    }
-
-    free(who);
-    free(username);
+  afs_status_t ast;
+  const char *userName;
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );  
+  int kas;
+  
+  if( !who ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( juserName != NULL ) {
+      userName = (*env)->GetStringUTFChars(env, juserName, 0);
+      if( !userName ) {
+       free( who );
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+      }
+  } else {
+      userName = NULL;
+  }
+
+  // make sure the name is within the allowed bounds
+  if( userName != NULL && strlen( userName ) > KAS_MAX_NAME_LEN ) {
+    free( who );
+    if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    throwAFSException( env, ADMPTSUSERNAMETOOLONG  );
+    return;
+  }
+
+  if( userName != NULL ) {
+      internal_makeKasIdentity( userName, who );
+  }
+
+  // delete the kas entry
+  if( !kas_PrincipalDelete( (void *) cellHandle, NULL, who, &ast ) ) {
+      if( ast != KANOENT ) {
+         free(who);
+         if( userName != NULL ) {
+             (*env)->ReleaseStringUTFChars(env, juserName, userName);
+         }
+         throwAFSException( env, ast );
+         return;
+      } else {
+         kas = FALSE;
+      }
+  }
+
+  //delete the pts entry
+  if( !pts_UserDelete( (void *) cellHandle, userName, &ast ) ) {
+      // throw exception if there was no such pts user only if there was 
+      // also no such kas user
+      if( (ast == ADMPTSFAILEDNAMETRANSLATE && !kas ) || 
+         ast != ADMPTSFAILEDNAMETRANSLATE ) {
+         free( who );
+         if( userName != NULL ) {
+             (*env)->ReleaseStringUTFChars(env, juserName, userName);
+         }
+         throwAFSException( env, ast );
+         return;
+      }
+  }
+
+  free( who );
+  // release converted java strings
+  if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
 }
 
 /**
@@ -264,53 +308,60 @@ Java_org_openafs_jafs_User_delete(JNIEnv * env, jclass cls, jint cellHandle,
  * env      the Java environment
  * cls      the current Java class
  * cellHandle    the handle of the cell to which the user belongs
- * jusername      the name of the user to unlock
+ * juserName      the name of the user to unlock
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_unlock(JNIEnv * env, jclass cls, jint cellHandle,
-                                 jstring jusername)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_unlock
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring juserName )
 {
-    afs_status_t ast;
-    char *username;
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-
-    if (!who) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-    // convert java strings
-    if (jusername != NULL) {
-       username = getNativeString(env, jusername);
-       if (username == NULL) {
-           free(who);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(who);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    // make sure the name is within the allowed bounds
-    if (strlen(username) > KAS_MAX_NAME_LEN) {
-       free(who);
-       free(username);
-       throwAFSException(env, ADMPTSUSERNAMETOOLONG);
-       return;
-    }
-
-    internal_makeKasIdentity(username, who);
-
-    if (!kas_PrincipalUnlock((void *)cellHandle, NULL, who, &ast)) {
-       free(who);
-       free(username);
-       throwAFSException(env, ast);
-       return;
-    }
-
-    free(who);
-    free(username);
+  afs_status_t ast;
+  const char *userName;
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );  
+  
+  if( !who ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  // convert java strings
+  if( juserName != NULL ) {
+      userName = (*env)->GetStringUTFChars(env, juserName, 0);
+    if( !userName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+      userName = NULL;
+  }
+
+  // make sure the name is within the allowed bounds
+  if( userName != NULL && strlen( userName ) > KAS_MAX_NAME_LEN ) {
+    free( who );
+    if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    throwAFSException( env, ADMPTSUSERNAMETOOLONG  );
+    return;
+  }  
+
+  if( userName != NULL ) {
+    internal_makeKasIdentity( userName, who );
+  }
+
+  if( !kas_PrincipalUnlock( (void *) cellHandle, NULL, who, &ast ) ) {
+    free( who );
+    if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  free( who );
+  // release converted java strings
+  if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
 }
 
 /**
@@ -322,207 +373,207 @@ Java_org_openafs_jafs_User_unlock(JNIEnv * env, jclass cls, jint cellHandle,
  * name      the name of the user for which to get the info
  * user      the User object to populate with the info
  */
-void
-getUserInfoChar(JNIEnv * env, int cellHandle, const char *name, jobject user)
+void getUserInfoChar
+  (JNIEnv *env, void *cellHandle, const char *name, jobject user)
 {
-    jstring jowner;
-    jstring jcreator;
-    jstring jlastModName;
-    jstring jencryptionKey;
-    jboolean pts;
-    jboolean kas;
-    pts_UserEntry_t ptsEntry;
-    afs_status_t ast;
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-    kas_principalEntry_t kasEntry;
-    unsigned int lockedUntil;
-
-    if (!who) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-    // make sure the name is within the allowed bounds
-    if (name != NULL && strlen(name) > KAS_MAX_NAME_LEN) {
-       free(who);
-       throwAFSException(env, ADMPTSUSERNAMETOOLONG);
+  jstring jowner;
+  jstring jcreator;
+  jstring jlastModName;
+  jstring jencryptionKey;
+  jboolean pts;
+  jboolean kas;
+  pts_UserEntry_t ptsEntry;
+  afs_status_t ast;
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );
+  kas_principalEntry_t kasEntry;
+  unsigned int lockedUntil;
+
+  if( !who ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  // make sure the name is within the allowed bounds
+  if( name != NULL && strlen( name ) > KAS_MAX_NAME_LEN ) {
+    free( who );
+    throwAFSException( env, ADMPTSUSERNAMETOOLONG );
+    return;
+  }
+  
+  if( name != NULL ) {
+      internal_makeKasIdentity( name, who );
+  }
+
+  // get all the field ids, if you haven't done so already
+  if( userCls == 0 ) {
+    internal_getUserClass( env, user );
+  }
+
+  // get the pts entry
+  if ( !pts_UserGet( cellHandle, name, &ptsEntry, &ast ) ) {
+    // if the user has no pts ptsEntry
+    if( ast == ADMPTSFAILEDNAMETRANSLATE ) {
+       pts = FALSE;    
+    } else {
+       free( who );
+       throwAFSException( env, ast );
        return;
     }
-
-    if (name != NULL) {
-       internal_makeKasIdentity(name, who);
-    }
-    // get all the field ids, if you haven't done so already
-    if (userCls == 0) {
-       internal_getUserClass(env, user);
-    }
-    // get the pts entry
-    if (!pts_UserGet((void *)cellHandle, name, &ptsEntry, &ast)) {
-       // if the user has no pts ptsEntry
-       if (ast == ADMPTSFAILEDNAMETRANSLATE) {
-           pts = FALSE;
-       } else {
-           free(who);
-           throwAFSException(env, ast);
+  } else {
+      pts = TRUE;
+  }
+  
+
+  // get the kas entry
+  if( !kas_PrincipalGet( cellHandle, NULL, who, &kasEntry, &ast ) ) {
+    // no kas entry
+    if( ast == KANOENT ) { 
+       if( !pts ) {
+           free( who );
+           throwAFSException( env, ast );
            return;
-       }
-    } else {
-       pts = TRUE;
-    }
-
-
-    // get the kas entry
-    if (!kas_PrincipalGet((void *)cellHandle, NULL, who, &kasEntry, &ast)) {
-       // no kas entry
-       if (ast == KANOENT) {
-           if (!pts) {
-               free(who);
-               throwAFSException(env, ast);
-               return;
-           } else {
-               kas = FALSE;
-           }
-           // other
        } else {
-           free(who);
-           throwAFSException(env, ast);
-           return;
+           kas = FALSE;
        }
+    // other
     } else {
-       kas = TRUE;
-    }
-
-    // get the lock status
-    if (kas
-       && !kas_PrincipalLockStatusGet((void *)cellHandle, NULL, who,
-                                      &lockedUntil, &ast)) {
-       free(who);
-       throwAFSException(env, ast);
+       free( who );
+       throwAFSException( env, ast );
        return;
     }
-
-    (*env)->SetBooleanField(env, user, user_ptsField, pts);
-    (*env)->SetBooleanField(env, user, user_kasField, kas);
-
-    // set the pts fields
-    if (pts) {
-       (*env)->SetIntField(env, user, user_nameUidField, ptsEntry.nameUid);
-       (*env)->SetIntField(env, user, user_ownerUidField, ptsEntry.ownerUid);
-       (*env)->SetIntField(env, user, user_creatorUidField,
-                           ptsEntry.creatorUid);
-       (*env)->SetIntField(env, user, user_groupCreationQuotaField,
-                           ptsEntry.groupCreationQuota);
-       (*env)->SetIntField(env, user, user_groupMembershipCountField,
-                           ptsEntry.groupMembershipCount);
-
-       if (ptsEntry.listStatus == PTS_USER_OWNER_ACCESS) {
-           (*env)->SetIntField(env, user, user_listStatusField,
-                               org_openafs_jafs_User_USER_OWNER_ACCESS);
-       } else {
-           (*env)->SetIntField(env, user, user_listStatusField,
-                               org_openafs_jafs_User_USER_ANYUSER_ACCESS);
-       }
-       if (ptsEntry.listGroupsOwned == PTS_USER_OWNER_ACCESS) {
-           (*env)->SetIntField(env, user, user_listGroupsOwnedField,
-                               org_openafs_jafs_User_USER_OWNER_ACCESS);
-       } else {
-           (*env)->SetIntField(env, user, user_listGroupsOwnedField,
-                               org_openafs_jafs_User_USER_ANYUSER_ACCESS);
-       }
-       if (ptsEntry.listMembership == PTS_USER_OWNER_ACCESS) {
-           (*env)->SetIntField(env, user, user_listMembershipField,
-                               org_openafs_jafs_User_USER_OWNER_ACCESS);
-       } else {
-           (*env)->SetIntField(env, user, user_listMembershipField,
-                               org_openafs_jafs_User_USER_ANYUSER_ACCESS);
-       }
-
-       jowner = (*env)->NewStringUTF(env, ptsEntry.owner);
-       jcreator = (*env)->NewStringUTF(env, ptsEntry.creator);
-
-       (*env)->SetObjectField(env, user, user_ownerField, jowner);
-       (*env)->SetObjectField(env, user, user_creatorField, jcreator);
-
-    }
-    // set the kas fields
-    if (kas) {
-       char *convertedKey;
-       int i;
-       if (kasEntry.adminSetting == KAS_ADMIN) {
-           (*env)->SetIntField(env, user, user_adminSettingField,
-                               org_openafs_jafs_User_ADMIN);
-       } else {
-           (*env)->SetIntField(env, user, user_adminSettingField,
-                               org_openafs_jafs_User_NO_ADMIN);
-       }
-       if (kasEntry.tgsSetting == TGS) {
-           (*env)->SetIntField(env, user, user_tgsSettingField,
-                               org_openafs_jafs_User_GRANT_TICKETS);
-       } else {
-           (*env)->SetIntField(env, user, user_tgsSettingField,
-                               org_openafs_jafs_User_NO_GRANT_TICKETS);
-       }
-       if (kasEntry.encSetting != NO_ENCRYPT) {
-           (*env)->SetIntField(env, user, user_encSettingField,
-                               org_openafs_jafs_User_ENCRYPT);
-       } else {
-           (*env)->SetIntField(env, user, user_encSettingField,
-                               org_openafs_jafs_User_NO_ENCRYPT);
-       }
-       if (kasEntry.cpwSetting == CHANGE_PASSWORD) {
-           (*env)->SetIntField(env, user, user_cpwSettingField,
-                               org_openafs_jafs_User_CHANGE_PASSWORD);
-       } else {
-           (*env)->SetIntField(env, user, user_cpwSettingField,
-                               org_openafs_jafs_User_NO_CHANGE_PASSWORD);
-       }
-       if (kasEntry.rpwSetting == REUSE_PASSWORD) {
-           (*env)->SetIntField(env, user, user_rpwSettingField,
-                               org_openafs_jafs_User_REUSE_PASSWORD);
-       } else {
-           (*env)->SetIntField(env, user, user_rpwSettingField,
-                               org_openafs_jafs_User_NO_REUSE_PASSWORD);
-       }
-       (*env)->SetIntField(env, user, user_userExpirationField,
-                           kasEntry.userExpiration);
-       (*env)->SetIntField(env, user, user_lastModTimeField,
-                           kasEntry.lastModTime);
-       (*env)->SetIntField(env, user, user_lastChangePasswordTimeField,
-                           kasEntry.lastChangePasswordTime);
-       (*env)->SetIntField(env, user, user_maxTicketLifetimeField,
-                           kasEntry.maxTicketLifetime);
-       (*env)->SetIntField(env, user, user_keyVersionField,
-                           kasEntry.keyVersion);
-       (*env)->SetLongField(env, user, user_keyCheckSumField,
-                            (unsigned int)kasEntry.keyCheckSum);
-       (*env)->SetIntField(env, user, user_daysToPasswordExpireField,
-                           kasEntry.daysToPasswordExpire);
-       (*env)->SetIntField(env, user, user_failLoginCountField,
-                           kasEntry.failLoginCount);
-       (*env)->SetIntField(env, user, user_lockTimeField, kasEntry.lockTime);
-       (*env)->SetIntField(env, user, user_lockedUntilField, lockedUntil);
-
-       jlastModName =
-           (*env)->NewStringUTF(env, kasEntry.lastModPrincipal.principal);
-       (*env)->SetObjectField(env, user, user_lastModNameField,
-                              jlastModName);
-
-       convertedKey =
-           (char *)malloc(sizeof(char *) *
-                          (sizeof(kasEntry.key.key) * 4 + 1));
-       if (!convertedKey) {
-           free(who);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-       for (i = 0; i < sizeof(kasEntry.key.key); i++) {
-           sprintf(&(convertedKey[i * 4]), "\\%0.3o", kasEntry.key.key[i]);
-       }
-       jencryptionKey = (*env)->NewStringUTF(env, convertedKey);
-       (*env)->SetObjectField(env, user, user_encryptionKeyField,
-                              jencryptionKey);
-       free(convertedKey);
-    }
-    free(who);
+  } else {
+      kas = TRUE;
+  }
+
+  // get the lock status
+  if( kas && !kas_PrincipalLockStatusGet( cellHandle, NULL, who, 
+                                         &lockedUntil, &ast ) ) {
+    free( who );
+    throwAFSException( env, ast );
+    return;
+  }
+
+  (*env)->SetBooleanField(env, user, user_ptsField, pts);
+  (*env)->SetBooleanField(env, user, user_kasField, kas);
+
+  // set the pts fields
+  if( pts ) {
+      (*env)->SetIntField(env, user, user_nameUidField, ptsEntry.nameUid);
+      (*env)->SetIntField(env, user, user_ownerUidField, ptsEntry.ownerUid);
+      (*env)->SetIntField(env, user, user_creatorUidField, 
+                         ptsEntry.creatorUid);
+      (*env)->SetIntField(env, user, user_groupCreationQuotaField, 
+                         ptsEntry.groupCreationQuota);
+      (*env)->SetIntField(env, user, user_groupMembershipCountField, 
+                         ptsEntry.groupMembershipCount);
+      
+      if( ptsEntry.listStatus == PTS_USER_OWNER_ACCESS ) {
+         (*env)->SetIntField(env, user, user_listStatusField, 
+                             org_openafs_jafs_User_USER_OWNER_ACCESS);
+      } else {
+         (*env)->SetIntField(env, user, user_listStatusField, 
+                             org_openafs_jafs_User_USER_ANYUSER_ACCESS);
+      }
+      if( ptsEntry.listGroupsOwned == PTS_USER_OWNER_ACCESS ) {
+         (*env)->SetIntField(env, user, user_listGroupsOwnedField, 
+                             org_openafs_jafs_User_USER_OWNER_ACCESS);
+      } else {
+         (*env)->SetIntField(env, user, user_listGroupsOwnedField, 
+                             org_openafs_jafs_User_USER_ANYUSER_ACCESS);
+      }
+      if( ptsEntry.listMembership == PTS_USER_OWNER_ACCESS ) {
+         (*env)->SetIntField(env, user, user_listMembershipField, 
+                             org_openafs_jafs_User_USER_OWNER_ACCESS);
+      } else {
+         (*env)->SetIntField(env, user, user_listMembershipField, 
+                             org_openafs_jafs_User_USER_ANYUSER_ACCESS);
+      }
+      
+      jowner = (*env)->NewStringUTF(env, ptsEntry.owner);
+      jcreator =  (*env)->NewStringUTF(env, ptsEntry.creator);
+      
+      (*env)->SetObjectField(env, user, user_ownerField, jowner);
+      (*env)->SetObjectField(env, user, user_creatorField, jcreator);
+
+  }
+
+  // set the kas fields
+  if( kas ) {
+      char *convertedKey;
+      int i;
+      if( kasEntry.adminSetting == KAS_ADMIN ) {
+         (*env)->SetIntField(env, user, user_adminSettingField, 
+                             org_openafs_jafs_User_ADMIN);
+      } else {
+         (*env)->SetIntField(env, user, user_adminSettingField, 
+                             org_openafs_jafs_User_NO_ADMIN);
+      }
+      if( kasEntry.tgsSetting == TGS ) {
+         (*env)->SetIntField(env, user, user_tgsSettingField, 
+                             org_openafs_jafs_User_GRANT_TICKETS);
+      } else {
+         (*env)->SetIntField(env, user, user_tgsSettingField, 
+                             org_openafs_jafs_User_NO_GRANT_TICKETS);
+      }
+      if( kasEntry.encSetting != NO_ENCRYPT ) {
+         (*env)->SetIntField(env, user, user_encSettingField, 
+                             org_openafs_jafs_User_ENCRYPT);
+      } else {
+         (*env)->SetIntField(env, user, user_encSettingField, 
+                             org_openafs_jafs_User_NO_ENCRYPT);
+      }
+      if( kasEntry.cpwSetting == CHANGE_PASSWORD ) {
+         (*env)->SetIntField(env, user, user_cpwSettingField, 
+                             org_openafs_jafs_User_CHANGE_PASSWORD);
+      } else {
+         (*env)->SetIntField(env, user, user_cpwSettingField, 
+                             org_openafs_jafs_User_NO_CHANGE_PASSWORD);
+      }
+      if( kasEntry.rpwSetting == REUSE_PASSWORD ) {
+         (*env)->SetIntField(env, user, user_rpwSettingField, 
+                             org_openafs_jafs_User_REUSE_PASSWORD);
+      } else {
+         (*env)->SetIntField(env, user, user_rpwSettingField, 
+                             org_openafs_jafs_User_NO_REUSE_PASSWORD);
+      }
+      (*env)->SetIntField(env, user, user_userExpirationField, 
+                         kasEntry.userExpiration);
+      (*env)->SetIntField(env, user, user_lastModTimeField, 
+                         kasEntry.lastModTime);
+      (*env)->SetIntField(env, user, user_lastChangePasswordTimeField, 
+                         kasEntry.lastChangePasswordTime);
+      (*env)->SetIntField(env, user, user_maxTicketLifetimeField, 
+                         kasEntry.maxTicketLifetime);
+      (*env)->SetIntField(env, user, user_keyVersionField, 
+                         kasEntry.keyVersion);
+      (*env)->SetLongField(env, user, user_keyCheckSumField, 
+                          (unsigned int) kasEntry.keyCheckSum);
+      (*env)->SetIntField(env, user, user_daysToPasswordExpireField, 
+                         kasEntry.daysToPasswordExpire);
+      (*env)->SetIntField(env, user, user_failLoginCountField, 
+                         kasEntry.failLoginCount);
+      (*env)->SetIntField(env, user, user_lockTimeField, kasEntry.lockTime);
+      (*env)->SetIntField(env, user, user_lockedUntilField, lockedUntil);
+      
+      jlastModName = (*env)->NewStringUTF(env, 
+                                         kasEntry.lastModPrincipal.principal);
+      (*env)->SetObjectField(env, user, user_lastModNameField, jlastModName);
+
+      convertedKey = (char *) malloc( sizeof(char *)*
+                                     (sizeof(kasEntry.key.key)*4+1) );
+      if( !convertedKey ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+      }
+      for( i = 0; i < sizeof(kasEntry.key.key); i++ ) {
+       sprintf( &(convertedKey[i*4]), "\\%0.3o", kasEntry.key.key[i] );
+      }
+      jencryptionKey =  (*env)->NewStringUTF(env, convertedKey);
+      (*env)->SetObjectField(env, user, user_encryptionKeyField, 
+                            jencryptionKey);
+      free( convertedKey );
+  }
+  free(who);
 }
 
 /**
@@ -536,34 +587,35 @@ getUserInfoChar(JNIEnv * env, int cellHandle, const char *name, jobject user)
  * user     the User object in which to fill in the 
  *                 information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_getUserInfo(JNIEnv * env, jclass cls,
-                                      jint cellHandle, jstring jname,
-                                      jobject user)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_getUserInfo
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname, jobject user)
 {
-    char *name;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (!name) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    getUserInfoChar(env, cellHandle, name, user);
-
-    // get class fields if need be
-    if (userCls == 0) {
-       internal_getUserClass(env, user);
-    }
-    // set name in case blank object
-    (*env)->SetObjectField(env, user, user_nameField, jname);
-
-    free(name);
+  const char *name;
+
+  if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+      name = NULL;
+  }
+
+  getUserInfoChar( env, cellHandle, name, user );
+  // get class fields if need be
+  if( userCls == 0 ) {
+    internal_getUserClass( env, user );
+  }
+  
+  // set name in case blank object
+  (*env)->SetObjectField(env, user, user_nameField, jname);
+  
+  if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
+  }      
 }
 
 /**
@@ -577,151 +629,158 @@ Java_org_openafs_jafs_User_getUserInfo(JNIEnv * env, jclass cls,
  * user  the User object containing the desired 
  *                 information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_setUserInfo(JNIEnv * env, jclass cls,
-                                      jint cellHandle, jstring jname,
-                                      jobject user)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_setUserInfo
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname, jobject user )
 {
-    char *name;
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-    pts_UserUpdateEntry_t ptsEntry;
-    afs_status_t ast;
-    kas_admin_t isAdmin;
-    kas_tgs_t grantTickets;
-    kas_enc_t canEncrypt;
-    kas_cpw_t canChangePassword;
-    kas_rpw_t passwordReuse;
-    unsigned int expirationDate;
-    unsigned int maxTicketLifetime;
-    unsigned int passwordExpires;
-    unsigned int failedPasswordAttempts;
-    unsigned int failedPasswordLockTime;
-    int kas;
-    int pts;
-
-    if (!who) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           free(who);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(who);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    // make sure the name is within the allowed bounds
-    if (strlen(name) > KAS_MAX_NAME_LEN) {
-       free(who);
-       free(name);
-       throwAFSException(env, ADMPTSUSERNAMETOOLONG);
-       return;
-    }
-
-    internal_makeKasIdentity(name, who);
-
-    // get class fields if need be
-    if (userCls == 0) {
-       internal_getUserClass(env, user);
-    }
-
-    kas = (*env)->GetBooleanField(env, user, user_kasField);
-    pts = (*env)->GetBooleanField(env, user, user_ptsField);
-
-    if (pts) {
-       // set the pts fields: 
-       ptsEntry.flag =
-           PTS_USER_UPDATE_GROUP_CREATE_QUOTA | PTS_USER_UPDATE_PERMISSIONS;
-       ptsEntry.groupCreationQuota =
-           (*env)->GetIntField(env, user, user_groupCreationQuotaField);
-       if ((*env)->GetIntField(env, user, user_listStatusField) ==
-           org_openafs_jafs_User_USER_OWNER_ACCESS) {
-           ptsEntry.listStatus = PTS_USER_OWNER_ACCESS;
-       } else {
-           ptsEntry.listStatus = PTS_USER_ANYUSER_ACCESS;
-       }
-       if ((*env)->GetIntField(env, user, user_listGroupsOwnedField) ==
-           org_openafs_jafs_User_USER_OWNER_ACCESS) {
-           ptsEntry.listGroupsOwned = PTS_USER_OWNER_ACCESS;
-       } else {
-           ptsEntry.listGroupsOwned = PTS_USER_ANYUSER_ACCESS;
-       }
-       if ((*env)->GetIntField(env, user, user_listMembershipField) ==
-           org_openafs_jafs_User_USER_OWNER_ACCESS) {
-           ptsEntry.listMembership = PTS_USER_OWNER_ACCESS;
-       } else {
-           ptsEntry.listMembership = PTS_USER_ANYUSER_ACCESS;
-       }
-       if (!pts_UserModify((void *)cellHandle, name, &ptsEntry, &ast)) {
-           free(who);
-           free(name);
-           throwAFSException(env, ast);
-           return;
-       }
-    }
-
-    if (kas) {
-       // set the kas fields:
-       if ((*env)->GetIntField(env, user, user_adminSettingField) ==
-           org_openafs_jafs_User_ADMIN) {
-           isAdmin = KAS_ADMIN;
-       } else {
-           isAdmin = NO_KAS_ADMIN;
-       }
-       if ((*env)->GetIntField(env, user, user_tgsSettingField) ==
-           org_openafs_jafs_User_GRANT_TICKETS) {
-           grantTickets = TGS;
-       } else {
-           grantTickets = NO_TGS;
-       }
-       if ((*env)->GetIntField(env, user, user_encSettingField) ==
-           org_openafs_jafs_User_ENCRYPT) {
-           canEncrypt = 0;
-       } else {
-           canEncrypt = NO_ENCRYPT;
-       }
-       if ((*env)->GetIntField(env, user, user_cpwSettingField) ==
-           org_openafs_jafs_User_CHANGE_PASSWORD) {
-           canChangePassword = CHANGE_PASSWORD;
-       } else {
-           canChangePassword = NO_CHANGE_PASSWORD;
-       }
-       if ((*env)->GetIntField(env, user, user_rpwSettingField) ==
-           org_openafs_jafs_User_REUSE_PASSWORD) {
-           passwordReuse = REUSE_PASSWORD;
-       } else {
-           passwordReuse = NO_REUSE_PASSWORD;
-       }
-       expirationDate =
-           (*env)->GetIntField(env, user, user_userExpirationField);
-       maxTicketLifetime =
-           (*env)->GetIntField(env, user, user_maxTicketLifetimeField);
-       passwordExpires =
-           (*env)->GetIntField(env, user, user_daysToPasswordExpireField);
-       failedPasswordAttempts =
-           (*env)->GetIntField(env, user, user_failLoginCountField);
-       failedPasswordLockTime =
-           (*env)->GetIntField(env, user, user_lockTimeField);
-
-
-       if (!kas_PrincipalFieldsSet
-           ((void *)cellHandle, NULL, who, &isAdmin, &grantTickets,
-            &canEncrypt, &canChangePassword, &expirationDate,
-            &maxTicketLifetime, &passwordExpires, &passwordReuse,
-            &failedPasswordAttempts, &failedPasswordLockTime, &ast)) {
-           throwAFSException(env, ast);
-       }
-    }
-
-    free(who);
-    free(name);
+  const char *name;
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );
+  pts_UserUpdateEntry_t ptsEntry;
+  afs_status_t ast;
+  kas_admin_t isAdmin;
+  kas_tgs_t grantTickets;
+  kas_enc_t canEncrypt;
+  kas_cpw_t canChangePassword;
+  kas_rpw_t passwordReuse;
+  unsigned int expirationDate;
+  unsigned int maxTicketLifetime;
+  unsigned int passwordExpires;
+  unsigned int failedPasswordAttempts;
+  unsigned int failedPasswordLockTime;
+  int kas;
+  int pts;
+
+  if( !who ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+      name = NULL;
+  }
+
+  // make sure the name is within the allowed bounds
+  if( name != NULL && strlen( name ) > KAS_MAX_NAME_LEN ) {
+    free( who );
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+    throwAFSException( env, ADMPTSUSERNAMETOOLONG );
+    return;
+  }
+
+  if( name != NULL ) {
+      internal_makeKasIdentity( name, who );
+  }
+
+  // get class fields if need be
+  if( userCls == 0 ) {
+    internal_getUserClass( env, user );
+  }
+
+  kas = (*env)->GetBooleanField(env, user, user_kasField);
+  pts = (*env)->GetBooleanField(env, user, user_ptsField);
+
+  if( pts ) {
+      // set the pts fields: 
+      ptsEntry.flag = PTS_USER_UPDATE_GROUP_CREATE_QUOTA | 
+       PTS_USER_UPDATE_PERMISSIONS;
+      ptsEntry.groupCreationQuota = 
+       (*env)->GetIntField(env, user, user_groupCreationQuotaField);
+      if( (*env)->GetIntField(env, user, user_listStatusField) == 
+         org_openafs_jafs_User_USER_OWNER_ACCESS ) {
+         ptsEntry.listStatus = PTS_USER_OWNER_ACCESS;
+      } else {
+         ptsEntry.listStatus = PTS_USER_ANYUSER_ACCESS;
+      }
+      if( (*env)->GetIntField(env, user, user_listGroupsOwnedField) == 
+         org_openafs_jafs_User_USER_OWNER_ACCESS ) {
+         ptsEntry.listGroupsOwned = PTS_USER_OWNER_ACCESS;
+      } else {
+         ptsEntry.listGroupsOwned = PTS_USER_ANYUSER_ACCESS;
+      }
+      if( (*env)->GetIntField(env, user, user_listMembershipField) == 
+         org_openafs_jafs_User_USER_OWNER_ACCESS ) {
+         ptsEntry.listMembership = PTS_USER_OWNER_ACCESS;
+      } else {
+         ptsEntry.listMembership = PTS_USER_ANYUSER_ACCESS;
+      }
+      if( !pts_UserModify( (void *) cellHandle, name, &ptsEntry, &ast ) ) {
+         free( who );
+         if( name != NULL ) {
+             (*env)->ReleaseStringUTFChars(env, jname, name);
+         }
+         throwAFSException( env, ast );
+         return;    
+      }
+  }
+
+  if( kas ) {
+      // set the kas fields:
+      if( (*env)->GetIntField(env, user, user_adminSettingField) == 
+         org_openafs_jafs_User_ADMIN ) {
+         isAdmin = KAS_ADMIN;
+      } else {
+         isAdmin = NO_KAS_ADMIN;
+      }
+      if( (*env)->GetIntField(env, user, user_tgsSettingField) == 
+         org_openafs_jafs_User_GRANT_TICKETS ) {
+         grantTickets = TGS;
+      } else {
+         grantTickets = NO_TGS;
+      }
+      if( (*env)->GetIntField(env, user, user_encSettingField) == 
+         org_openafs_jafs_User_ENCRYPT ) {
+         canEncrypt = 0;
+      } else {
+         canEncrypt = NO_ENCRYPT;
+      }
+      if( (*env)->GetIntField(env, user, user_cpwSettingField) == 
+         org_openafs_jafs_User_CHANGE_PASSWORD ) {
+         canChangePassword = CHANGE_PASSWORD;
+      } else {
+         canChangePassword = NO_CHANGE_PASSWORD;
+      }
+      if( (*env)->GetIntField(env, user, user_rpwSettingField) == 
+         org_openafs_jafs_User_REUSE_PASSWORD ) {
+         passwordReuse = REUSE_PASSWORD;
+      } else {
+         passwordReuse = NO_REUSE_PASSWORD;
+      }
+      expirationDate = (*env)->GetIntField(env, user, 
+                                          user_userExpirationField);
+      maxTicketLifetime = (*env)->GetIntField(env, user, 
+                                             user_maxTicketLifetimeField);
+      passwordExpires = (*env)->GetIntField(env, user, 
+                                           user_daysToPasswordExpireField);
+      failedPasswordAttempts = (*env)->GetIntField(env, user, 
+                                                  user_failLoginCountField);
+      failedPasswordLockTime =  (*env)->GetIntField(env, user, 
+                                                   user_lockTimeField);
+      
+      if( !kas_PrincipalFieldsSet( (void *) cellHandle, NULL, who, &isAdmin, 
+                                  &grantTickets, &canEncrypt, 
+                                  &canChangePassword, &expirationDate, 
+                                  &maxTicketLifetime, &passwordExpires, 
+                                  &passwordReuse, &failedPasswordAttempts, 
+                                  &failedPasswordLockTime, &ast ) ) {
+         free( who );
+         if( name != NULL ) {
+             (*env)->ReleaseStringUTFChars(env, jname, name);
+         }
+         throwAFSException( env, ast );
+         return;    
+      }
+  }      
+
+  free( who );
+  if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
 }
 
 /**
@@ -734,169 +793,196 @@ Java_org_openafs_jafs_User_setUserInfo(JNIEnv * env, jclass cls,
  * joldName     the name of the user to rename
  * jnewName     the new name for the user
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_rename(JNIEnv * env, jclass cls, jint cellHandle,
-                                 jstring joldName, jstring jnewName)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_rename
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring joldName, jstring jnewName)
 {
-    char *oldName;
-    char *newName;
-    kas_identity_p whoOld = (kas_identity_p) malloc(sizeof(kas_identity_t));
-    kas_identity_p whoNew = (kas_identity_p) malloc(sizeof(kas_identity_t));
+
+    const char *oldName;
+    const char *newName;
+    kas_identity_p whoOld = (kas_identity_p) malloc( sizeof(kas_identity_t) );
+    kas_identity_p whoNew = (kas_identity_p) malloc( sizeof(kas_identity_t) );
     kas_principalEntry_t kasEntry;
     pts_UserEntry_t ptsEntry;
     afs_status_t ast;
     int kas;
 
-    if (!whoOld || !whoNew) {
-       if (whoOld) {
-           free(whoOld);
-       }
-       if (whoNew) {
-           free(whoNew);
-       }
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-
-    if (joldName != NULL) {
-       oldName = getNativeString(env, joldName);
-       if (oldName == NULL) {
-           free(whoOld);
-           free(whoNew);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
+    if( !whoOld || !whoNew ) {
+      if( whoOld ) {
+       free( whoOld );
+      }
+      if( whoNew ) {
+       free( whoNew );
+      } 
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+
+    if( joldName != NULL ) {
+       oldName = (*env)->GetStringUTFChars(env, joldName, 0);
+       if( !oldName ) {
+           throwAFSException( env, JAFSADMNOMEM );
+           return;    
        }
     } else {
        oldName = NULL;
     }
-    if (jnewName != NULL) {
-       newName = getNativeString(env, jnewName);
-       if (newName == NULL) {
-           free(whoOld);
-           free(whoNew);
-           if (oldName != NULL)
-               free(oldName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
+    if( jnewName != NULL ) {
+       newName = (*env)->GetStringUTFChars(env, jnewName, 0);
+       if( !newName ) {
+         if( oldName != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+         }
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
        }
     } else {
        newName = NULL;
     }
 
     // make sure the names are within the allowed bounds
-    if ((oldName != NULL && strlen(oldName) > KAS_MAX_NAME_LEN)
-       || (newName != NULL && strlen(newName) > KAS_MAX_NAME_LEN)) {
-       free(whoOld);
-       free(whoNew);
-       if (oldName != NULL)
-           free(oldName);
-       if (newName != NULL)
-           free(newName);
-       throwAFSException(env, ADMPTSUSERNAMETOOLONG);
+    if( oldName != NULL && strlen( oldName ) > KAS_MAX_NAME_LEN ) {
+       free( whoOld );
+       free( whoNew );
+       if( oldName != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+       }
+       if( newName != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+       }
+       throwAFSException( env, ADMPTSUSERNAMETOOLONG );
        return;
     }
-
-    if (oldName != NULL) {
-       internal_makeKasIdentity(oldName, whoOld);
+    if( newName != NULL && strlen( newName ) > KAS_MAX_NAME_LEN ) {
+       free( whoOld );
+       free( whoNew );
+       if( oldName != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+       }
+       if( newName != NULL ) {
+           (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+       }
+       throwAFSException( env, ADMPTSUSERNAMETOOLONG );
+       return;
     }
-    if (newName != NULL) {
-       internal_makeKasIdentity(newName, whoNew);
+    
+    if( oldName != NULL ) {
+       internal_makeKasIdentity( oldName, whoOld );
     }
+    if( newName != NULL ) {
+       internal_makeKasIdentity( newName, whoNew );
+    }
+
     // retrieve the old kas info
-    if (!kas_PrincipalGet((void *)cellHandle, NULL, whoOld, &kasEntry, &ast)) {
-       if (ast != KANOENT) {
-           free(whoOld);
-           free(whoNew);
-           if (oldName != NULL)
-               free(oldName);
-           if (newName != NULL)
-               free(newName);
-           throwAFSException(env, ast);
+    if( !kas_PrincipalGet( (void *) cellHandle, NULL, whoOld, 
+                          &kasEntry, &ast ) ) {
+       if( ast != KANOENT ) {
+           free( whoOld );
+           free( whoNew );
+           if( oldName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+           }
+           if( newName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+           }
+           throwAFSException( env, ast );
            return;
        } else {
            kas = FALSE;
        }
     } else {
        kas = TRUE;
-    }
-
-    if (kas) {
+    }   
+       
+    if( kas ) {
        // create a new kas entry
        // temporarily set the password equal to the new name
-       if (!kas_PrincipalCreate
-           ((void *)cellHandle, NULL, whoNew, newName, &ast)) {
-           free(whoOld);
-           free(whoNew);
-           if (oldName != NULL)
-               free(oldName);
-           if (newName != NULL)
-               free(newName);
-           throwAFSException(env, ast);
+       if (!kas_PrincipalCreate( (void *) cellHandle, NULL, whoNew, 
+                                 newName, &ast ) ) {       
+           free( whoOld );
+           free( whoNew );
+           if( oldName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+           }
+           if( newName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+           }
+           throwAFSException( env, ast );
            return;
-       }
+       } 
+
        // set the password 
        ast = 0;
        // For some reason kas_PrincipalKeySet doesn't set the return code 
        // correctly.  It always returns 0.
        // So instead of checking the return code, we see if there's an 
        // error in the status variable.
-       kas_PrincipalKeySet((void *)cellHandle, NULL, whoNew, 0,
-                           &(kasEntry.key), &ast);
-       if (ast) {
+       kas_PrincipalKeySet( (void *) cellHandle, NULL, whoNew, 0, 
+                            &(kasEntry.key), &ast );
+       if( ast ) {
            afs_status_t ast_kd;
-           kas_PrincipalDelete((void *)cellHandle, NULL, whoNew, &ast_kd);
-           free(whoOld);
-           free(whoNew);
-           if (oldName != NULL)
-               free(oldName);
-           if (newName != NULL)
-               free(newName);
-           throwAFSException(env, ast);
+           kas_PrincipalDelete( (void *) cellHandle, NULL, whoNew, &ast_kd );
+           free( whoOld );
+           free( whoNew );
+           if( oldName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+           }
+           if( newName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+           }
+           throwAFSException( env, ast );
            return;
        }
     }
+
     // rename the pts entry
-    if (!pts_UserRename((void *)cellHandle, oldName, newName, &ast)) {
+    if( !pts_UserRename( (void *) cellHandle, oldName, newName, &ast ) ) {
        // throw exception if there was no such pts user only if 
-       // there was also no such kas user
-       if ((ast == ADMPTSFAILEDNAMETRANSLATE && !kas)
-           || ast != ADMPTSFAILEDNAMETRANSLATE) {
+        // there was also no such kas user
+       if( (ast == ADMPTSFAILEDNAMETRANSLATE && !kas ) || 
+           ast != ADMPTSFAILEDNAMETRANSLATE ) {
            afs_status_t ast_kd;
-           if (kas) {
-               kas_PrincipalDelete((void *)cellHandle, NULL, whoNew,
-                                   &ast_kd);
+           if( kas ) {
+               kas_PrincipalDelete( (void *) cellHandle, NULL, whoNew, 
+                                    &ast_kd );
+           }
+           free( whoOld );
+           free( whoNew );
+           if( oldName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+           }
+           if( newName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, jnewName, newName);
            }
-           free(whoOld);
-           free(whoNew);
-           if (oldName != NULL)
-               free(oldName);
-           if (newName != NULL)
-               free(newName);
-           throwAFSException(env, ast);
+           throwAFSException( env, ast );
            return;
        }
     }
 
-    if (kas) {
+    if( kas ) {
        // delete the old kas entry
-       if (!kas_PrincipalDelete((void *)cellHandle, NULL, whoOld, &ast)) {
-           free(whoOld);
-           free(whoNew);
-           if (oldName != NULL)
-               free(oldName);
-           if (newName != NULL)
-               free(newName);
-           throwAFSException(env, ast);
+       if( !kas_PrincipalDelete( (void *) cellHandle, NULL, whoOld, &ast ) ) {
+           free( whoOld );
+           free( whoNew );
+           if( oldName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+           }
+           if( newName != NULL ) {
+               (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+           }
+           throwAFSException( env, ast );
            return;
        }
-    }
+    }    
 
-    free(whoOld);
-    free(whoNew);
-    if (oldName != NULL)
-       free(oldName);
-    if (newName != NULL)
-       free(newName);
+    free( whoOld );
+    free( whoNew );
+    if( oldName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, joldName, oldName);
+    }
+    if( newName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+    }
 }
 
 /**
@@ -905,109 +991,124 @@ Java_org_openafs_jafs_User_rename(JNIEnv * env, jclass cls, jint cellHandle,
  * env      the Java environment
  * cls      the current Java class
  * cellHandle    the handle of the cell to which the user belongs
- * jusername     the name of the user for which to set the password
+ * juserName     the name of the user for which to set the password
  * jnewPassword     the new password for the user
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_setPassword(JNIEnv * env, jclass cls,
-                                      jint cellHandle, jstring jusername,
-                                      jstring jnewPassword)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_setPassword
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring juserName,
+   jstring jnewPassword)
 {
-    afs_status_t ast;
-    char *cellName;
-    char *username;
-    char *newPassword;
-    kas_encryptionKey_p newKey =
-       (kas_encryptionKey_p) malloc(sizeof(kas_encryptionKey_t));
-    kas_identity_p who = (kas_identity_p) malloc(sizeof(kas_identity_t));
-
-    if (!who || !newKey) {
-       if (who) {
-           free(who);
-       }
-       if (newKey) {
-           free(newKey);
-       }
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-
-    if (jusername != NULL) {
-       username = getNativeString(env, jusername);
-       if (username == NULL) {
-           free(who);
-           free(newKey);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(who);
-       free(newKey);
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    if (jnewPassword != NULL) {
-       newPassword = getNativeString(env, jnewPassword);
-       if (newPassword == NULL) {
-           free(who);
-           free(newKey);
-           free(username);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       free(who);
-       free(newKey);
-       free(username);
-       throwAFSException(env, JAFSNULLPASS);
-       return;
-    }
-
-    // make sure the name is within the allowed bounds
-    if (strlen(username) > KAS_MAX_NAME_LEN) {
-       free(who);
-       free(newKey);
-       free(username);
-       free(newPassword);
-       throwAFSException(env, ADMPTSUSERNAMETOOLONG);
-       return;
-    }
-
-    if (!afsclient_CellNameGet((void *)cellHandle, &cellName, &ast)) {
-       free(who);
-       free(newKey);
-       free(username);
-       free(newPassword);
-       throwAFSException(env, ast);
-       return;
-    }
-
-    if (!kas_StringToKey(cellName, newPassword, newKey, &ast)) {
-       free(who);
-       free(newKey);
-       free(username);
-       free(newPassword);
-       throwAFSException(env, ast);
-       return;
-    }
-
-    internal_makeKasIdentity(username, who);
-
-    ast = 0;
-    // For some reason kas_PrincipalKeySet doesn't set the return code correctly.
-    //  It always returns 0.
-    // So instead of checking the return code, we see if there's an error 
-    // in the status variable.
-    kas_PrincipalKeySet((void *)cellHandle, NULL, who, 0, newKey, &ast);
-    if (ast) {
-       throwAFSException(env, ast);
-    }
-
+  afs_status_t ast;
+  char *cellName;
+  const char *userName;
+  const char *newPassword;
+  kas_encryptionKey_p newKey = 
+    (kas_encryptionKey_p) malloc( sizeof(kas_encryptionKey_t) );
+  kas_identity_p who = (kas_identity_p) malloc( sizeof(kas_identity_t) );
+
+  if( !who || !newKey ) {
+    if( who ) {
+      free( who );
+    }
+    if( newKey ) {
+      free( newKey );
+    }
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( juserName != NULL ) {
+      userName = (*env)->GetStringUTFChars(env, juserName, 0);
+      if( !userName ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
+  } else {
+      userName = NULL;
+  }
+  if( jnewPassword != NULL ) {
+      newPassword = (*env)->GetStringUTFChars(env, jnewPassword, 0);
+      if( !newPassword ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
+  } else {
+      newPassword = NULL;
+  }
+
+  // make sure the name is within the allowed bounds
+  if( userName != NULL && strlen( userName ) > KAS_MAX_NAME_LEN ) {
     free(who);
-    free(newKey);
-    free(username);
-    free(newPassword);
+    free( newKey );
+    if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    if( newPassword != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jnewPassword, newPassword);
+    }
+    throwAFSException( env, ADMPTSUSERNAMETOOLONG );
+    return;
+  }
+
+  if( !afsclient_CellNameGet( (void *) cellHandle, &cellName, &ast ) ) {
+      free(who);
+      free( newKey );
+      if( userName != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, juserName, userName);
+      }
+      if( newPassword != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jnewPassword, newPassword);
+      }
+      throwAFSException( env, ast );
+      return;
+  }
+  
+  if( !kas_StringToKey( cellName, newPassword, newKey, &ast ) ) {
+      free(who);
+      free( newKey );
+      if( userName != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, juserName, userName);
+      }
+      if( newPassword != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jnewPassword, newPassword);
+      }
+      throwAFSException( env, ast );
+      return;
+  }
+
+  if( userName != NULL ) {
+      internal_makeKasIdentity( userName, who );
+  }
+
+  ast = 0;
+  // For some reason kas_PrincipalKeySet doesn't set the return code correctly.
+  //  It always returns 0.
+  // So instead of checking the return code, we see if there's an error 
+  // in the status variable.
+  kas_PrincipalKeySet( (void *) cellHandle, NULL, who, 0, newKey, &ast );
+  if( ast ) {
+    free( who );
+    free( newKey );
+    if( userName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, juserName, userName);
+    }
+    if( newPassword != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jnewPassword, newPassword);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  free( who );
+  free( newKey );
+  if( userName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, juserName, userName);
+  }
+  if( newPassword != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jnewPassword, newPassword);
+  }
+
 }
 
 /**
@@ -1021,33 +1122,39 @@ Java_org_openafs_jafs_User_setPassword(JNIEnv * env, jclass cls,
  * jname          the name of the user for which to get the groups
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_User_getUserGroupsBegin(JNIEnv * env, jclass cls,
-                                             jint cellHandle, jstring jname)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_User_getUserGroupsBegin
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname)
 {
-    char *name;
-    afs_status_t ast;
-    void *iterationId;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLUSER);
-       return;
-    }
-
-    if (!pts_UserMemberListBegin
-       ((void *)cellHandle, name, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-    }
+  const char *name;
+  afs_status_t ast;
+  void *iterationId;
+
+  if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+      if( !name ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
+  } else {
+      name = NULL;
+  }
+
+  if( !pts_UserMemberListBegin( (void *) cellHandle, name, &iterationId, 
+                               &ast ) ) {
+      if( name != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jname, name);
+      }
+      throwAFSException( env, ast );
+      return;
+  }
+
+  if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
+
+  return (jlong) iterationId;
 
-    free(name);
-
-    return (jint) iterationId;
 }
 
 /**
@@ -1059,32 +1166,32 @@ Java_org_openafs_jafs_User_getUserGroupsBegin(JNIEnv * env, jclass cls,
  * iterationId   the iteration ID of this iteration
  * returns the name of the next group
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_User_getUserGroupsNextString(JNIEnv * env, jclass cls,
-                                                  jint iterationId)
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_User_getUserGroupsNextString
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
-    char *groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-    jstring jgroup;
-
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-
-    if (!pts_UserMemberListNext((void *)iterationId, groupName, &ast)) {
-       free(groupName);
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return;
-       }
-    }
-
-    jgroup = (*env)->NewStringUTF(env, groupName);
-    free(groupName);
-    return jgroup;
+  afs_status_t ast;
+  char *groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+  jstring jgroup;
+
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( !pts_UserMemberListNext( (void *) iterationId, groupName, &ast ) ) {
+    free( groupName );
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
+    }
+  }
+  
+  jgroup = (*env)->NewStringUTF(env, groupName);
+  free( groupName );
+  return jgroup;
 }
 
 /**
@@ -1099,46 +1206,45 @@ Java_org_openafs_jafs_User_getUserGroupsNextString(JNIEnv * env, jclass cls,
  *                   next group
  * returns 0 if there are no more users, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_User_getUserGroupsNext(JNIEnv * env, jclass cls,
-                                            jint cellHandle,
-                                            jint iterationId,
-                                            jobject jgroupObject)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_User_getUserGroupsNext
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong iterationId,
+   jobject jgroupObject)
 {
-    afs_status_t ast;
-    char *groupName;
-    jstring jgroup;
+  afs_status_t ast;
+  char *groupName;
+  jstring jgroup;
 
-    groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
 
-    if (!pts_UserMemberListNext((void *)iterationId, groupName, &ast)) {
-       free(groupName);
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
+  if( !pts_UserMemberListNext( (void *) iterationId, groupName, &ast ) ) {
+    free( groupName );
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    jgroup = (*env)->NewStringUTF(env, groupName);
+  jgroup = (*env)->NewStringUTF(env, groupName);
 
-    if (groupCls == 0) {
-       internal_getGroupClass(env, jgroupObject);
-    }
+  if( groupCls == 0 ) {
+    internal_getGroupClass( env, jgroupObject );
+  }
 
-    (*env)->SetObjectField(env, jgroupObject, group_nameField, jgroup);
+  (*env)->SetObjectField(env, jgroupObject, group_nameField, jgroup);
 
-    getGroupInfoChar(env, (void *)cellHandle, groupName, jgroupObject);
-    (*env)->SetBooleanField(env, jgroupObject, group_cachedInfoField, TRUE);
+  getGroupInfoChar( env, (void *) cellHandle, groupName, jgroupObject );
+  (*env)->SetBooleanField( env, jgroupObject, group_cachedInfoField, TRUE );
 
-    free(groupName);
-    return 1;
+  free( groupName );
+  return 1;
 
 }
 
@@ -1149,16 +1255,16 @@ Java_org_openafs_jafs_User_getUserGroupsNext(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_getUserGroupsDone(JNIEnv * env, jclass cls,
-                                            jint iterationId)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_getUserGroupsDone
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
+  afs_status_t ast;
 
-    if (!pts_UserMemberListDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  if( !pts_UserMemberListDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 }
 
 /**
@@ -1170,38 +1276,38 @@ Java_org_openafs_jafs_User_getUserGroupsDone(JNIEnv * env, jclass cls,
  * jname          the name of the user for which to get the groups
  * returns total number of groups owned by the user
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_User_getGroupsOwnedCount(JNIEnv * env, jclass cls,
-                                              jint cellHandle, jstring jname)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_User_getGroupsOwnedCount
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname)
 {
-    afs_status_t ast;
-    void *iterationId;
-    char *groupName;
-    int i = 0;
+  afs_status_t ast;
+  void *iterationId;
+  char *groupName;
+  int i = 0;
 
-    iterationId =
-       (void *)Java_org_openafs_jafs_User_getGroupsOwnedBegin(env, cls,
-                                                              cellHandle,
-                                                              jname);
+  iterationId = 
+    (void *) Java_org_openafs_jafs_User_getGroupsOwnedBegin( env, cls, 
+                                                               cellHandle, 
+                                                               jname );
 
-    groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return -1;
-    }
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return -1;    
+  }
 
-    while (pts_OwnedGroupListNext((void *)iterationId, groupName, &ast))
-       i++;
+  while ( pts_OwnedGroupListNext( (void *) iterationId, groupName, &ast ) ) 
+    i++;
 
-    free(groupName);
+  free( groupName );  
 
-    if (ast != ADMITERATORDONE) {
-       throwAFSException(env, ast);
-       return -1;
-    }
+  if( ast != ADMITERATORDONE ) {
+    throwAFSException( env, ast );
+    return -1;
+  }
 
-    return i;
+  return i;
 }
 
 /**
@@ -1215,33 +1321,39 @@ Java_org_openafs_jafs_User_getGroupsOwnedCount(JNIEnv * env, jclass cls,
  * jname  the name of the user or group for which to get the groups
  * returns an iteration ID
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_User_getGroupsOwnedBegin(JNIEnv * env, jclass cls,
-                                              jint cellHandle, jstring jname)
+JNIEXPORT jlong JNICALL 
+Java_org_openafs_jafs_User_getGroupsOwnedBegin
+  (JNIEnv *env, jclass cls, jlong cellHandle, jstring jname)
 {
-    char *name;
-    afs_status_t ast;
-    void *iterationId;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (name == NULL) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return -1;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLUSER);
-       return -1;
-    }
-
-    if (!pts_OwnedGroupListBegin
-       ((void *)cellHandle, name, &iterationId, &ast)) {
-       throwAFSException(env, ast);
-    }
-
-    free(name);
+  const char *name;
+  afs_status_t ast;
+  void *iterationId;
+
+  if( jname != NULL ) {
+      name = (*env)->GetStringUTFChars(env, jname, 0);
+      if( !name ) {
+         throwAFSException( env, JAFSADMNOMEM );
+         return;    
+      }
+  } else {
+      name = NULL;
+  }
+
+  if( !pts_OwnedGroupListBegin( (void *) cellHandle, name, 
+                               &iterationId, &ast ) ) {
+      if( jname != NULL ) {
+         (*env)->ReleaseStringUTFChars(env, jname, name);
+      }
+      throwAFSException( env, ast );
+      return;
+  }
+
+  if( jname != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
+
+  return (jlong) iterationId;
 
-    return (jint) iterationId;
 }
 
 /**
@@ -1253,32 +1365,32 @@ Java_org_openafs_jafs_User_getGroupsOwnedBegin(JNIEnv * env, jclass cls,
  * iterationId   the iteration ID of this iteration
  * returns the name of the next group
  */
-JNIEXPORT jstring JNICALL
-Java_org_openafs_jafs_User_getGroupsOwnedNextString(JNIEnv * env, jclass cls,
-                                                   jint iterationId)
+JNIEXPORT jstring JNICALL 
+Java_org_openafs_jafs_User_getGroupsOwnedNextString
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
-    char *groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
-    jstring jgroup;
-
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return;
-    }
-
-    if (!pts_OwnedGroupListNext((void *)iterationId, groupName, &ast)) {
-       free(groupName);
-       if (ast == ADMITERATORDONE) {
-           return NULL;
-       } else {
-           throwAFSException(env, ast);
-           return NULL;
-       }
+  afs_status_t ast;
+  char *groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
+  jstring jgroup;
+
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
+
+  if( !pts_OwnedGroupListNext( (void *) iterationId, groupName, &ast ) ) {
+    free( groupName );
+    if( ast == ADMITERATORDONE ) {
+      return NULL;
+    } else {
+      throwAFSException( env, ast );
+      return;
     }
-
-    jgroup = (*env)->NewStringUTF(env, groupName);
-    free(groupName);
-    return jgroup;
+  }
+  
+  jgroup = (*env)->NewStringUTF(env, groupName);
+  free( groupName );
+  return jgroup;
 
 }
 
@@ -1294,46 +1406,45 @@ Java_org_openafs_jafs_User_getGroupsOwnedNextString(JNIEnv * env, jclass cls,
  *                   next group
  * returns 0 if there are no more users, != 0 otherwise
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_User_getGroupsOwnedNext(JNIEnv * env, jclass cls,
-                                             jint cellHandle,
-                                             jint iterationId,
-                                             jobject jgroupObject)
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_User_getGroupsOwnedNext
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong iterationId, 
+   jobject jgroupObject)
 {
-    afs_status_t ast;
-    char *groupName;
-    jstring jgroup;
+  afs_status_t ast;
+  char *groupName;
+  jstring jgroup;
 
-    groupName = (char *)malloc(sizeof(char) * PTS_MAX_NAME_LEN);
+  groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
 
-    if (!groupName) {
-       throwAFSException(env, JAFSADMNOMEM);
-       return 0;
-    }
+  if( !groupName ) {
+    throwAFSException( env, JAFSADMNOMEM );
+    return;    
+  }
 
-    if (!pts_OwnedGroupListNext((void *)iterationId, groupName, &ast)) {
-       free(groupName);
-       if (ast == ADMITERATORDONE) {
-           return 0;
-       } else {
-           throwAFSException(env, ast);
-           return 0;
-       }
+  if( !pts_OwnedGroupListNext( (void *) iterationId, groupName, &ast ) ) {
+    free( groupName );
+    if( ast == ADMITERATORDONE ) {
+      return 0;
+    } else {
+      throwAFSException( env, ast );
+      return 0;
     }
+  }
 
-    jgroup = (*env)->NewStringUTF(env, groupName);
+  jgroup = (*env)->NewStringUTF(env, groupName);
 
-    if (groupCls == 0) {
-       internal_getGroupClass(env, jgroupObject);
-    }
+  if( groupCls == 0 ) {
+    internal_getGroupClass( env, jgroupObject );
+  }
 
-    (*env)->SetObjectField(env, jgroupObject, group_nameField, jgroup);
+  (*env)->SetObjectField(env, jgroupObject, group_nameField, jgroup);
 
-    getGroupInfoChar(env, (void *)cellHandle, groupName, jgroupObject);
-    (*env)->SetBooleanField(env, jgroupObject, group_cachedInfoField, TRUE);
+  getGroupInfoChar( env, (void *) cellHandle, groupName, jgroupObject );
+  (*env)->SetBooleanField( env, jgroupObject, group_cachedInfoField, TRUE );
 
-    free(groupName);
-    return 1;
+  free( groupName );
+  return 1;
 
 }
 
@@ -1344,24 +1455,30 @@ Java_org_openafs_jafs_User_getGroupsOwnedNext(JNIEnv * env, jclass cls,
  * cls      the current Java class
  * iterationId   the iteration ID of this iteration
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_getGroupsOwnedDone(JNIEnv * env, jclass cls,
-                                             jint iterationId)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_User_getGroupsOwnedDone
+  (JNIEnv *env, jclass cls, jlong iterationId)
 {
-    afs_status_t ast;
+  afs_status_t ast;
 
-    if (!pts_OwnedGroupListDone((void *)iterationId, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  if( !pts_OwnedGroupListDone( (void *) iterationId, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+  
 }
 
 // reclaim global memory being used by this portion
 JNIEXPORT void JNICALL
-Java_org_openafs_jafs_User_reclaimUserMemory(JNIEnv * env, jclass cls)
+Java_org_openafs_jafs_User_reclaimUserMemory
+  (JNIEnv *env, jclass cls)
 {
-    if (userCls) {
-       (*env)->DeleteGlobalRef(env, userCls);
-       userCls = 0;
-    }
+  if( userCls ) {
+      (*env)->DeleteGlobalRef(env, userCls);
+      userCls = 0;
+  }
+
 }
+
+
+
index 1bd597f..1fa5b48 100644 (file)
@@ -27,6 +27,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <afs/vice.h>
+#include <netinet/in.h>
 #include <afs/venus.h>
 #include <afs/afs_args.h>
 /*#include <afs/afs_osi.h>
 #endif
 
 pthread_mutex_t jafs_init_lock;
-
 extern pthread_mutex_t jafs_login_lock;
-
 extern int readCacheParms(char *afsMountPoint, char *afsConfDir,
-                         char *afsCacheDir, int *cacheBlocks,
-                         int *cacheFiles, int *cacheStatEntries,
-                         int *dCacheSize, int *vCacheSize, int *chunkSize,
-                         int *closeSynch, int *debug, int *nDaemons,
-                         int *cacheFlags, char *logFile);
+                          char *afsCacheDir,  int *cacheBlocks, 
+                          int *cacheFiles, int *cacheStatEntries,
+                          int *dCacheSize, int *vCacheSize, int *chunkSize,
+                          int *closeSynch, int *debug, int *nDaemons, 
+                          int *cacheFlags, char *logFile);
 
 /**
  * Be carefull with the memory management:
  *
- * - For every getNativeString call the corresponding free().
+ * - For every GetStringUTFChars call the corresponding ReleaseStringUTFChars.
  * - For every Get<type>ArrayElements call the corresponding
  *   Release<type>ArrayElements
  * - For every malloc call the corresponding free.
  */
 
-int
-osi_audit(void)
+int osi_audit(void)
 {
-    return 0;
+   return 0;
 }
 
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_callDebugger(JNIEnv * env, jobject obj)
+/*JNIEXPORT void JNICALL Java_org_openafs_jafs_Token_callDebugger
+  (JNIEnv *env, jobject obj)
 {
     fprintf(stderr, "callDebugger called\n");
     __asm__("int $0x3");
-}
+}*/
 
 /**
  * Initialize the user space library.
@@ -82,67 +80,72 @@ Java_org_openafs_jafs_Token_callDebugger(JNIEnv * env, jobject obj)
  *
  * throws AFSException
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_initUserSpace(JNIEnv * env, jclass cls)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_Token_initUserSpace
+  (JNIEnv *env, jclass cls)
 {
-    char afsMountPoint[100], afsConfDir[100], afsCacheDir[100], logFile[100];
-    jfieldID fid;
-    int pagval;
-
-    /* Initialize each init parameter with its associated default value */
-    int cacheBlocks = 100000;
-    int cacheFiles = 12500;
-    int cacheStatEntries = 8192;
-    int dCacheSize = 11398;
-    int vCacheSize = 128;
-    int chunkSize = 0;
-    int closeSynch = 0;
-    int debug = 0;
-    int nDaemons = 3;
-    int cacheFlags = -1;
-
-    /* Initialize each init parameter with its associated default value */
-    strcpy(afsMountPoint, "/afs");
-    strcpy(afsConfDir, "/usr/afswsp/etc");
-    strcpy(afsCacheDir, "/usr/afswsp/cache");
-    strcpy(logFile, "/usr/afswsp/log/libjafs.log");
-
-    pthread_mutex_init(&jafs_init_lock, NULL);
-    pthread_mutex_lock(&jafs_init_lock);
-
-    readCacheParms(afsMountPoint, afsConfDir, afsCacheDir, &cacheBlocks,
-                  &cacheFiles, &cacheStatEntries, &dCacheSize, &vCacheSize,
-                  &chunkSize, &closeSynch, &debug, &nDaemons, &cacheFlags,
-                  logFile);
-
-    /* See cache.tune for configuration details */
-    if (debug) {
-       fprintf(stderr, "uafs_Init(\"init_native\", \"%s\", \"%s\", \"%s\",
-                      %d, %d, %d,
-                      %d, %d, %d,
-                      %d, %d, %d, %d, \"%s\");\n", afsMountPoint, afsConfDir, afsCacheDir, cacheBlocks, cacheFiles, cacheStatEntries, dCacheSize, vCacheSize, chunkSize, closeSynch, debug, nDaemons, cacheFlags, logFile);
-    }
-    uafs_Init("init_native", afsMountPoint, afsConfDir, afsCacheDir,
-             cacheBlocks, cacheFiles, cacheStatEntries, dCacheSize,
-             vCacheSize, chunkSize, closeSynch, debug, nDaemons, cacheFlags,
-             logFile);
-
-
-    /* make the initial pag the unauthenticated pag */
-    afs_setpag();
-    uafs_unlog();
-    pagval = afs_getpag_val();
-
-    fid = (*env)->GetStaticFieldID(env, cls, "ANYUSER_PAG_ID", "I");
-    if (fid == 0) {
-       fprintf(stderr,
-               "UserToken::init(): GetFieldID (ANYUSER_PAG_ID) failed\n");
-       return;
-    }
-
-    (*env)->SetStaticIntField(env, cls, fid, pagval);
-
-    pthread_mutex_unlock(&jafs_init_lock);
+  char afsMountPoint[100], afsConfDir[100], afsCacheDir[100], logFile[100];
+  jfieldID fid;
+  int pagval;
+
+  /* Initialize each init parameter with its associated default value */
+  int cacheBlocks = 100000;
+  int cacheFiles  = 12500;
+  int cacheStatEntries = 8192;
+  int dCacheSize  = 11398;
+  int vCacheSize  = 128;
+  int chunkSize   = 0;
+  int closeSynch  = 0;
+  int debug       = 0;
+  int nDaemons    = 3; 
+  int cacheFlags  = -1;
+
+  /* Initialize each init parameter with its associated default value */
+  strcpy(afsMountPoint, "/afs");
+  strcpy(afsConfDir,  "/usr/afswsp/etc");
+  strcpy(afsCacheDir, "/usr/afswsp/cache");
+  strcpy(logFile,     "/usr/afswsp/log/libjafs.log");
+
+  pthread_mutex_init(&jafs_init_lock, NULL);
+  pthread_mutex_lock(&jafs_init_lock);
+
+  readCacheParms(afsMountPoint, afsConfDir, afsCacheDir,
+                 &cacheBlocks, &cacheFiles, &cacheStatEntries,
+                 &dCacheSize, &vCacheSize, &chunkSize,
+                 &closeSynch, &debug, &nDaemons, &cacheFlags,
+                 logFile);
+
+  /* See cache.tune for configuration details */
+  if (debug) {
+    fprintf(stderr, "uafs_Init(\"init_native\", \"%s\", \"%s\", \"%s\"",
+                      "%d, %d, %d,"
+                      "%d, %d, %d,"
+                      "%d, %d, %d, %d, \"%s\");\n",
+              afsMountPoint, afsConfDir, afsCacheDir,
+              cacheBlocks, cacheFiles, cacheStatEntries,
+              dCacheSize, vCacheSize, chunkSize,
+              closeSynch, debug, nDaemons, cacheFlags, logFile);
+  }
+  uafs_Init("init_native", afsMountPoint, afsConfDir, afsCacheDir,
+             cacheBlocks, cacheFiles, cacheStatEntries,
+             dCacheSize, vCacheSize, chunkSize,
+             closeSynch, debug, nDaemons, cacheFlags, logFile);
+
+
+  /* make the initial pag the unauthenticated pag */
+  afs_setpag();
+  uafs_unlog();
+  pagval = afs_getpag_val();
+
+  fid = (*env)->GetStaticFieldID(env, cls, "ANYUSER_PAG_ID", "I");
+  if (fid == 0) {
+    fprintf(stderr,
+    "UserToken::init(): GetFieldID (ANYUSER_PAG_ID) failed\n");
+    return;
+  }
+    
+  (*env)->SetStaticIntField(env, cls, fid, pagval);
+
+  pthread_mutex_unlock(&jafs_init_lock);
 }
 
 /**
@@ -160,103 +163,95 @@ Java_org_openafs_jafs_Token_initUserSpace(JNIEnv * env, jclass cls)
  * throws AFSException
  */
 JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Token_klog(JNIEnv * env, jobject obj, jstring jusername,
-                                jstring jpassword, jstring jcell, jint id)
+Java_org_openafs_jafs_Token_klog (JNIEnv *env, jobject obj,
+  jstring jusername, jstring jpassword, jstring jcell, jint id)
 {
-    char *username;
-    char *password;
-    char *cell;
-    char *reason;
-    int code;
-    jint rc = -1;
-
-    if (jcell != NULL) {
-       cell = getNativeString(env, jcell);
-       if (!cell) {
-           fprintf(stderr, "UserToken::klog(): failed to get cell name\n");
-           throwMessageException(env,
-                                 "Internal error, failed to translate cell name.");
-           return -1;
-       }
-    } else {
-       cell = NULL;
+  char *username;
+  char *password;
+  char *cell;
+  char *reason;
+  jint rc = -1;
+  int code;
+
+  if( jcell != NULL ) { 
+    cell = (char*) (*env)->GetStringUTFChars(env, jcell, 0);
+    if( !cell ) {
+      char *error = "UserToken::klog(): failed to get cell name\n";
+      fprintf(stderr, error);
+      throwMessageException( env, error );
+      return -1;
     }
-
-    if (jusername != NULL) {
-       username = getNativeString(env, jusername);
-       if (!username) {
-           if (cell != NULL)
-               free(cell);
-           fprintf(stderr, "UserToken::klog(): failed to get username\n");
-           throwMessageException(env,
-                                 "Internal error, failed to translate username.");
-           return -1;
-       }
-    } else {
-       if (cell != NULL)
-           free(cell);
-       throwAFSException(env, JAFSNULLUSER);
-       return -1;
+  } else {
+    cell = NULL;
+  }
+
+  if( jusername != NULL ) {
+    username = (char*) (*env)->GetStringUTFChars(env, jusername, 0);
+    if( !username ) {
+      char *error = "UserToken::klog(): failed to get username\n";
+      (*env)->ReleaseStringUTFChars(env, jcell, cell);
+      fprintf(stderr, error);
+      throwMessageException( env, error );
+      return -1;
     }
-
-    if (jpassword != NULL) {
-       password = getNativeString(env, jpassword);
-       if (!password) {
-           if (cell != NULL)
-               free(cell);
-           free(username);
-           fprintf(stderr, "UserToken::klog(): failed to get password\n");
-           throwMessageException(env,
-                                 "Internal error, failed to translate password.");
-           return -1;
-       }
-    } else {
-       if (cell != NULL)
-           free(cell);
-       free(username);
-       throwAFSException(env, JAFSNULLPASS);
-       return -1;
+  } else {
+    username = NULL;
+  }
+  if( jpassword != NULL ) {
+    password = (char*) (*env)->GetStringUTFChars(env, jpassword, 0);
+    if( !password ) {
+      char *error = "UserToken::klog(): failed to get password\n";
+      (*env)->ReleaseStringUTFChars(env, jcell, cell);
+      (*env)->ReleaseStringUTFChars(env, jusername, username);
+      fprintf(stderr, error);
+      throwMessageException( env, error );
+      return -1;
     }
-
-    if (id == 0) {
-       code = uafs_klog(username, cell, password, &reason);
-    } else {
-       /* Use existing PAG for this thread */
-       code = afs_setpag_val(id);
-       if (code != 0)
-           code = 180492L;     /* KABADARGUMENT */
-       if (!code)
-           code = uafs_klog_nopag(username, cell, password, &reason);
+  } else {
+    password = NULL;
+  }
+
+  if (id == 0) {
+    code = uafs_klog(username, cell, password, &reason);
+  } else {
+    /* Use existing PAG for this thread */
+    code = afs_setpag_val(id);
+    if (code != 0) code = 180492L;  /* KABADARGUMENT */
+    if (!code) code = uafs_klog_nopag(username, cell, password, &reason);
+  }
+
+  if (code != 0) {
+    if( cell != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jcell, cell);
     }
-
-    if (code != 0) {
-       if (cell != NULL)
-           free(cell);
-       if (username != NULL)
-           free(username);
-       if (password != NULL)
-           free(password);
-       fprintf(stderr,
-               "UserToken::klog(): uafs_klog failed to cell %s: %s\n", cell,
-               reason);
-       fprintf(stderr, "code = %d\n", code);
-       throwAFSException(env, code);
-       return -1;
+    if( username != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jusername, username);
     }
-
-    /* Get the PAG we were assigned as the return value */
-    rc = afs_getpag_val();
-
-    /* clean up */
-    if (cell != NULL)
-       free(cell);
-    if (username != NULL)
-       free(username);
-    if (password != NULL)
-       free(password);
-
-    /* return PAG ID */
-    return rc;
+    if( password != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jpassword, password);
+    }
+    fprintf(stderr, "UserToken::klog(): uafs_klog failed to cell %s: %s\n",
+                     cell, reason);
+    fprintf(stderr, "code = %d\n", code);
+    throwAFSException( env, code );
+  }
+
+  /* Get the PAG we were assigned as the return value */
+  rc = afs_getpag_val();
+
+  /* clean up */
+  if( cell != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jcell, cell);
+  }
+  if( username != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jusername, username);
+  }
+  if( password != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jpassword, password);
+  }
+
+  /* return PAG ID */
+  return rc;
 }
 
 /**
@@ -273,16 +268,16 @@ Java_org_openafs_jafs_Token_klog(JNIEnv * env, jobject obj, jstring jusername,
  *
  * throws AFSException
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_relog(JNIEnv * env, jobject obj, jint id)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_Token_relog
+  (JNIEnv *env, jobject obj, jint id)
 {
-    int rc;
+  int rc;
 
-    rc = afs_setpag_val(id);
+  rc = afs_setpag_val(id);
 
-    if (rc != 0) {
-       throwAFSException(env, rc);
-    }
+  if (rc != 0) {
+    throwAFSException( env, rc );
+  }
 }
 
 /**
@@ -294,16 +289,16 @@ Java_org_openafs_jafs_Token_relog(JNIEnv * env, jobject obj, jint id)
  *
  * throws AFSException
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_unlog(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_Token_unlog
+  (JNIEnv *env, jobject obj)
 {
-    int rc;
+  int rc;
 
-    rc = uafs_unlog();
+  rc = uafs_unlog();
 
-    if (rc != 0) {
-       throwAFSException(env, rc);
-    }
+  if (rc != 0) {
+    throwAFSException( env, rc );
+  }
 }
 
 /**
@@ -318,8 +313,12 @@ Java_org_openafs_jafs_Token_unlog(JNIEnv * env, jobject obj)
  *
  * throws AFSException
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Token_shutdown(JNIEnv * env, jobject obj)
+JNIEXPORT void JNICALL Java_org_openafs_jafs_Token_shutdown
+  (JNIEnv *env, jobject obj)
 {
-    uafs_Shutdown();
+  uafs_Shutdown();
 }
+
+
+
+
diff --git a/src/JAVA/libjafs/Version2.c b/src/JAVA/libjafs/Version2.c
new file mode 100644 (file)
index 0000000..20c3979
--- /dev/null
@@ -0,0 +1,14 @@
+#include "JAFS_Version.h"
+#include "org_openafs_jafs_VersionInfo.h"
+
+JNIEXPORT jstring JNICALL Java_org_openafs_jafs_VersionInfo_getVersionOfLibjafsadm
+  (JNIEnv *env, jobject obj)
+{
+       return (*env)->NewStringUTF(env, VERSION_LIB_JAVA_OPENAFS);
+}
+
+JNIEXPORT jstring JNICALL Java_org_openafs_jafs_VersionInfo_getBuildInfoOfLibjafsadm
+  (JNIEnv *env, jobject obj)
+{
+       return (*env)->NewStringUTF(env, cml_version_number);
+}
diff --git a/src/JAVA/libjafs/VersionInfo.c b/src/JAVA/libjafs/VersionInfo.c
new file mode 100644 (file)
index 0000000..8e16d9f
--- /dev/null
@@ -0,0 +1,14 @@
+#include "JAFS_Version.h"
+#include "org_openafs_jafs_VersionInfo.h"
+JNIEXPORT jstring JNICALL Java_org_openafs_jafs_VersionInfo_getVersionOfLibjafs
+  (JNIEnv *env, jobject obj)
+{
+       return (*env)->NewStringUTF(env, VERSION_LIB_JAVA_OPENAFS);
+}
+
+JNIEXPORT jstring JNICALL Java_org_openafs_jafs_VersionInfo_getBuildInfoOfLibjafs
+  (JNIEnv *env, jobject obj)
+{
+       return (*env)->NewStringUTF(env, cml_version_number);
+}
index ef2f3c4..41f7be4 100644 (file)
@@ -56,168 +56,168 @@ extern jfieldID volume_typeField;
  * volume      the Volume object to populate with the info
  * volEntry     the container of the volume's information
  */
-extern void
-fillVolumeInfo(JNIEnv * env, jobject volume, vos_volumeEntry_t volEntry)
-{
-    jstring jvolume;
-
-    // get the class fields if need be
-    if (volumeCls == 0) {
-       internal_getVolumeClass(env, volume);
-    }
-    // set name, just in case it was a completely blank object
-    jvolume = (*env)->NewStringUTF(env, volEntry.name);
-    (*env)->SetObjectField(env, volume, volume_nameField, jvolume);
-
-    (*env)->SetIntField(env, volume, volume_idField, volEntry.id);
-    (*env)->SetIntField(env, volume, volume_readWriteIdField,
-                       volEntry.readWriteId);
-    (*env)->SetIntField(env, volume, volume_readOnlyIdField,
-                       volEntry.readOnlyId);
-    (*env)->SetIntField(env, volume, volume_backupIdField, volEntry.backupId);
-    (*env)->SetLongField(env, volume, volume_creationDateField,
-                        volEntry.creationDate);
-    (*env)->SetLongField(env, volume, volume_lastAccessDateField,
-                        volEntry.lastAccessDate);
-    (*env)->SetLongField(env, volume, volume_lastUpdateDateField,
-                        volEntry.lastUpdateDate);
-    (*env)->SetLongField(env, volume, volume_lastBackupDateField,
-                        volEntry.lastBackupDate);
-    (*env)->SetLongField(env, volume, volume_copyCreationDateField,
-                        volEntry.copyCreationDate);
-    (*env)->SetIntField(env, volume, volume_accessesSinceMidnightField,
-                       volEntry.accessesSinceMidnight);
-    (*env)->SetIntField(env, volume, volume_fileCountField,
-                       volEntry.fileCount);
-    (*env)->SetIntField(env, volume, volume_maxQuotaField, volEntry.maxQuota);
-    (*env)->SetIntField(env, volume, volume_currentSizeField,
-                       volEntry.currentSize);
-
-    // set status variable
-    switch (volEntry.status) {
-    case VOS_OK:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_OK);
-       break;
-    case VOS_SALVAGE:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_SALVAGE);
-       break;
-    case VOS_NO_VNODE:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_NO_VNODE);
-       break;
-    case VOS_NO_VOL:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_NO_VOL);
-       break;
-    case VOS_VOL_EXISTS:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_VOL_EXISTS);
-       break;
-    case VOS_NO_SERVICE:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_NO_SERVICE);
-       break;
-    case VOS_OFFLINE:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_OFFLINE);
-       break;
-    case VOS_ONLINE:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_ONLINE);
-       break;
-    case VOS_DISK_FULL:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_DISK_FULL);
-       break;
-    case VOS_OVER_QUOTA:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_OVER_QUOTA);
-       break;
-    case VOS_BUSY:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_BUSY);
-       break;
-    case VOS_MOVED:
-       (*env)->SetIntField(env, volume, volume_statusField,
-                           org_openafs_jafs_Volume_VOLUME_MOVED);
-       break;
-    default:
-       throwAFSException(env, volEntry.status);
-    }
-
-    // set disposition variable
-    switch (volEntry.volumeDisposition) {
-    case VOS_OK:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_OK);
-       break;
-    case VOS_SALVAGE:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_SALVAGE);
-       break;
-    case VOS_NO_VNODE:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_NO_VNODE);
-       break;
-    case VOS_NO_VOL:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_NO_VOL);
-       break;
-    case VOS_VOL_EXISTS:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_VOL_EXISTS);
-       break;
-    case VOS_NO_SERVICE:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_NO_SERVICE);
-       break;
-    case VOS_OFFLINE:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_OFFLINE);
-       break;
-    case VOS_ONLINE:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_ONLINE);
-       break;
-    case VOS_DISK_FULL:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_DISK_FULL);
-       break;
-    case VOS_OVER_QUOTA:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_OVER_QUOTA);
-       break;
-    case VOS_BUSY:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_BUSY);
-       break;
-    case VOS_MOVED:
-       (*env)->SetIntField(env, volume, volume_dispositionField,
-                           org_openafs_jafs_Volume_VOLUME_MOVED);
-       break;
-    default:
-       throwAFSException(env, volEntry.volumeDisposition);
-    }
-
-    // set type variable
-    switch (volEntry.type) {
-    case VOS_READ_WRITE_VOLUME:
-       (*env)->SetIntField(env, volume, volume_typeField,
-                           org_openafs_jafs_Volume_VOLUME_TYPE_READ_WRITE);
-       break;
-    case VOS_READ_ONLY_VOLUME:
-       (*env)->SetIntField(env, volume, volume_typeField,
-                           org_openafs_jafs_Volume_VOLUME_TYPE_READ_ONLY);
-       break;
-    case VOS_BACKUP_VOLUME:
-       (*env)->SetIntField(env, volume, volume_typeField,
-                           org_openafs_jafs_Volume_VOLUME_TYPE_BACKUP);
-       break;
-    default:
-       throwAFSException(env, volEntry.type);
-    }
+extern void fillVolumeInfo( JNIEnv *env, jobject volume, 
+                           vos_volumeEntry_t volEntry ) {
+
+  jstring jvolume;
+
+  // get the class fields if need be
+  if( volumeCls == 0 ) {
+    internal_getVolumeClass( env, volume );
+  }
+
+  // set name, just in case it was a completely blank object
+  jvolume = (*env)->NewStringUTF(env, volEntry.name);
+  (*env)->SetObjectField(env, volume, volume_nameField, jvolume);
+
+  (*env)->SetIntField(env, volume, volume_idField, volEntry.id);
+  (*env)->SetIntField(env, volume, volume_readWriteIdField, 
+                     volEntry.readWriteId);
+  (*env)->SetIntField(env, volume, volume_readOnlyIdField, 
+                     volEntry.readOnlyId);
+  (*env)->SetIntField(env, volume, volume_backupIdField, volEntry.backupId);
+  (*env)->SetLongField(env, volume, volume_creationDateField, 
+                      volEntry.creationDate);
+  (*env)->SetLongField(env, volume, volume_lastAccessDateField, 
+                      volEntry.lastAccessDate);
+  (*env)->SetLongField(env, volume, volume_lastUpdateDateField, 
+                      volEntry.lastUpdateDate);
+  (*env)->SetLongField(env, volume, volume_lastBackupDateField, 
+                      volEntry.lastBackupDate);
+  (*env)->SetLongField(env, volume, volume_copyCreationDateField, 
+                      volEntry.copyCreationDate);
+  (*env)->SetIntField(env, volume, volume_accessesSinceMidnightField, 
+                     volEntry.accessesSinceMidnight);
+  (*env)->SetIntField(env, volume, volume_fileCountField, volEntry.fileCount);
+  (*env)->SetIntField(env, volume, volume_maxQuotaField, volEntry.maxQuota);
+  (*env)->SetIntField(env, volume, volume_currentSizeField, 
+                     volEntry.currentSize);
+
+  // set status variable
+  switch( volEntry.status ) {
+  case VOS_OK :
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_OK);
+      break;
+  case VOS_SALVAGE :
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_SALVAGE);
+      break;
+  case VOS_NO_VNODE:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_NO_VNODE);
+      break;
+  case VOS_NO_VOL:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_NO_VOL);
+      break;
+  case VOS_VOL_EXISTS:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_VOL_EXISTS);
+      break;
+  case VOS_NO_SERVICE:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_NO_SERVICE);
+      break;
+  case VOS_OFFLINE:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_OFFLINE);
+      break;
+  case VOS_ONLINE:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_ONLINE);
+      break;
+  case VOS_DISK_FULL:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_DISK_FULL);
+      break;
+  case VOS_OVER_QUOTA:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_OVER_QUOTA);
+      break;
+  case VOS_BUSY:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_BUSY);
+      break;
+  case VOS_MOVED:
+      (*env)->SetIntField(env, volume, volume_statusField, 
+                         org_openafs_jafs_Volume_VOLUME_MOVED);
+      break;
+  default:
+      throwAFSException( env, volEntry.status );
+  }
+
+  // set disposition variable
+  switch( volEntry.volumeDisposition ) {
+  case VOS_OK :
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_OK);
+      break;
+  case VOS_SALVAGE :
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_SALVAGE);
+      break;
+  case VOS_NO_VNODE:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_NO_VNODE);
+      break;
+  case VOS_NO_VOL:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_NO_VOL);
+      break;
+  case VOS_VOL_EXISTS:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_VOL_EXISTS);
+      break;
+  case VOS_NO_SERVICE:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_NO_SERVICE);
+      break;
+  case VOS_OFFLINE:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_OFFLINE);
+      break;
+  case VOS_ONLINE:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_ONLINE);
+      break;
+  case VOS_DISK_FULL:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_DISK_FULL);
+      break;
+  case VOS_OVER_QUOTA:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_OVER_QUOTA);
+      break;
+  case VOS_BUSY:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_BUSY);
+      break;
+  case VOS_MOVED:
+      (*env)->SetIntField(env, volume, volume_dispositionField, 
+                         org_openafs_jafs_Volume_VOLUME_MOVED);
+      break;
+  default:
+      throwAFSException( env, volEntry.volumeDisposition );
+  }
+
+  // set type variable
+  switch( volEntry.type ) {
+  case VOS_READ_WRITE_VOLUME:
+      (*env)->SetIntField(env, volume, volume_typeField, 
+                         org_openafs_jafs_Volume_VOLUME_TYPE_READ_WRITE);
+      break;
+  case VOS_READ_ONLY_VOLUME:
+      (*env)->SetIntField(env, volume, volume_typeField, 
+                         org_openafs_jafs_Volume_VOLUME_TYPE_READ_ONLY);
+      break;
+  case VOS_BACKUP_VOLUME:
+      (*env)->SetIntField(env, volume, volume_typeField, 
+                         org_openafs_jafs_Volume_VOLUME_TYPE_BACKUP);
+      break;
+  default:
+      throwAFSException( env, volEntry.type );
+  }
 
 }
 
@@ -235,24 +235,26 @@ fillVolumeInfo(JNIEnv * env, jobject volume, vos_volumeEntry_t volEntry)
  * jvolumeObject   the Volume object in which to fill in 
  *                        the information
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_getVolumeInfo(JNIEnv * env, jclass cls,
-                                          jint cellHandle, jint serverHandle,
-                                          jint partition, jint volID,
-                                          jobject jvolumeObject)
-{
-    afs_status_t ast;
-    vos_volumeEntry_t volEntry;
-
-    // get the volume entry
-    if (!vos_VolumeGet
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, (unsigned int)volID, &volEntry, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_getVolumeInfo (JNIEnv *env, jclass cls, 
+                                              jlong cellHandle, 
+                                              jlong serverHandle, 
+                                              jint partition, jint volID, 
+                                              jobject jvolumeObject) {
+
+  afs_status_t ast;
+  vos_volumeEntry_t volEntry;
+
+  // get the volume entry
+  if ( !vos_VolumeGet( (void *) cellHandle, (void *) serverHandle, NULL, 
+                      (unsigned int) partition, (unsigned int) volID, 
+                      &volEntry, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
+  fillVolumeInfo( env, jvolumeObject, volEntry );
 
-    fillVolumeInfo(env, jvolumeObject, volEntry);
 }
 
 /**
@@ -269,35 +271,41 @@ Java_org_openafs_jafs_Volume_getVolumeInfo(JNIEnv * env, jclass cls,
  * quota    the amount of space (in KB) to set as this volume's quota
  * returns the numeric ID assigned to the volume
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Volume_create(JNIEnv * env, jclass cls, jint cellHandle,
-                                   jint serverHandle, jint partition,
-                                   jstring jvolName, jint quota)
-{
-    afs_status_t ast;
-    char *volName;
-    int id;
-
-    if (jvolName != NULL) {
-       volName = getNativeString(env, jvolName);
-       if (!volName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return -1;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLVOLUME);
-       return -1;
-    }
-
-    if (!vos_VolumeCreate
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, volName, (unsigned int)quota, &id, &ast)) {
-       throwAFSException(env, ast);
-    }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Volume_create (JNIEnv *env, jclass cls, 
+                                       jlong cellHandle, jlong serverHandle, 
+                                       jint partition, jstring jvolName, 
+                                       jint quota) {
+
+  afs_status_t ast;
+  const char *volName;
+  int id;
+
+  if( jvolName != NULL ) {
+    volName = (*env)->GetStringUTFChars(env, jvolName, 0);
+    if( !volName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    volName = NULL;
+  }
+
+  if( !vos_VolumeCreate( (void *) cellHandle, (void *) serverHandle, NULL, 
+                        (unsigned int) partition, volName, 
+                        (unsigned int) quota, &id, &ast ) ) {
+    if( volName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jvolName, volName);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( volName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jvolName, volName);
+  }
+  return (jint) id;
 
-    free(volName);
-
-    return (jint) id;
 }
 
 /**
@@ -312,19 +320,20 @@ Java_org_openafs_jafs_Volume_create(JNIEnv * env, jclass cls, jint cellHandle,
  *                    the volume
  * volId   the numeric id of the volume to delete
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_delete(JNIEnv * env, jclass cls, jint cellHandle,
-                                   jint serverHandle, jint partition,
-                                   jint volID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_delete (JNIEnv *env, jclass cls, 
+                                       jlong cellHandle, jlong serverHandle, 
+                                       jint partition, jint volID) {
+
+  afs_status_t ast;
+
+  if( !vos_VolumeDelete( (void *) cellHandle, (void *) serverHandle, NULL, 
+                        (unsigned int) partition, 
+                        (unsigned int) volID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VolumeDelete
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, (unsigned int)volID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -336,17 +345,19 @@ Java_org_openafs_jafs_Volume_delete(JNIEnv * env, jclass cls, jint cellHandle,
  * volId  the numeric id of the volume for which to create a backup 
  *               volume
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_createBackupVolume(JNIEnv * env, jclass cls,
-                                               jint cellHandle, jint volID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_createBackupVolume (JNIEnv *env, jclass cls, 
+                                                   jlong cellHandle, 
+                                                   jint volID) {
+
+  afs_status_t ast;
+
+  if( !vos_BackupVolumeCreate( (void *) cellHandle, NULL, 
+                              (unsigned int) volID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_BackupVolumeCreate
-       ((void *)cellHandle, NULL, (unsigned int)volID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -362,20 +373,22 @@ Java_org_openafs_jafs_Volume_createBackupVolume(JNIEnv * env, jclass cls,
  * volId  the numeric id of the volume for which to 
  *               create a read-only volume
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_createReadOnlyVolume(JNIEnv * env, jclass cls,
-                                                 jint cellHandle,
-                                                 jint serverHandle,
-                                                 jint partition, jint volID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_createReadOnlyVolume (JNIEnv *env, jclass cls, 
+                                                     jlong cellHandle, 
+                                                     jlong serverHandle, 
+                                                     jint partition, 
+                                                     jint volID) {
+
+  afs_status_t ast;
+
+  if( !vos_VLDBReadOnlySiteCreate( (void *) cellHandle, (void *) serverHandle, 
+                                  NULL, (unsigned int) partition, 
+                                  (unsigned int) volID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VLDBReadOnlySiteCreate
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, (unsigned int)volID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -391,20 +404,22 @@ Java_org_openafs_jafs_Volume_createReadOnlyVolume(JNIEnv * env, jclass cls,
  * volId  the numeric read-write id of the volume for which to 
  *               delete the read-only volume
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_deleteReadOnlyVolume(JNIEnv * env, jclass cls,
-                                                 jint cellHandle,
-                                                 jint serverHandle,
-                                                 jint partition, jint volID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_deleteReadOnlyVolume (JNIEnv *env, jclass cls, 
+                                                     jlong cellHandle, 
+                                                     jlong serverHandle, 
+                                                     jint partition, 
+                                                     jint volID) {
+
+  afs_status_t ast;
+
+  if( !vos_VLDBReadOnlySiteDelete( (void *) cellHandle, (void *) serverHandle, 
+                                  NULL, (unsigned int) partition, 
+                                  (unsigned int) volID, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VLDBReadOnlySiteDelete
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, (unsigned int)volID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -420,21 +435,23 @@ Java_org_openafs_jafs_Volume_deleteReadOnlyVolume(JNIEnv * env, jclass cls,
  * volId  the numeric id of the volume for which to change the quota
  * newQuota    the new quota (in KB) to assign the volume
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_changeQuota(JNIEnv * env, jclass cls,
-                                        jint cellHandle, jint serverHandle,
-                                        jint partition, jint volID,
-                                        jint newQuota)
-{
-    afs_status_t ast;
-
-    if (!vos_VolumeQuotaChange
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, (unsigned int)volID, (unsigned int)newQuota,
-        &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_changeQuota (JNIEnv *env, jclass cls, 
+                                            jlong cellHandle, 
+                                            jlong serverHandle, 
+                                            jint partition, jint volID, 
+                                            jint newQuota) {
+
+  afs_status_t ast;
+
+  if( !vos_VolumeQuotaChange( (void *) cellHandle, (void *) serverHandle, 
+                             NULL, (unsigned int) partition, 
+                             (unsigned int) volID, (unsigned int) newQuota, 
+                             &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
 }
 
 /**
@@ -453,21 +470,21 @@ Java_org_openafs_jafs_Volume_changeQuota(JNIEnv * env, jclass cls,
  *                      should be moved
  * volId  the numeric id of the volume to move
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_move(JNIEnv * env, jclass cls, jint cellHandle,
-                                 jint fromServerHandle, jint fromPartition,
-                                 jint toServerHandle, jint toPartition,
-                                 jint volID)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_move
+  (JNIEnv *env, jclass cls, jlong cellHandle, jlong fromServerHandle, 
+   jint fromPartition, jlong toServerHandle, jint toPartition, jint volID)
 {
-    afs_status_t ast;
-
-    if (!vos_VolumeMove
-       ((void *)cellHandle, NULL, (unsigned int)volID,
-        (void *)fromServerHandle, (unsigned int)fromPartition,
-        (void *)toServerHandle, (unsigned int)toPartition, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
+  afs_status_t ast;
+
+  if( !vos_VolumeMove( (void *) cellHandle, NULL, (unsigned int) volID, 
+                      (void *) fromServerHandle, (unsigned int) fromPartition,
+                      (void *) toServerHandle, (unsigned int) toPartition, 
+                      &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
+
 }
 
 /**
@@ -479,25 +496,25 @@ Java_org_openafs_jafs_Volume_move(JNIEnv * env, jclass cls, jint cellHandle,
  * volId  the numeric id of the volume to release
  * forceComplete  whether or not to force a complete release
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_release(JNIEnv * env, jclass cls,
-                                    jint cellHandle, jint volID,
-                                    jboolean forceComplete)
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_release
+  (JNIEnv *env, jclass cls, jlong cellHandle, jint volID, jboolean forceComplete)
 {
-    afs_status_t ast;
-    vos_force_t force;
+  afs_status_t ast;
+  vos_force_t force;
 
-    if (forceComplete) {
-       force = VOS_FORCE;
-    } else {
-       force = VOS_NORMAL;
-    }
+  if( forceComplete ) {
+    force = VOS_FORCE;
+  } else {
+    force = VOS_NORMAL;
+  }
+
+  if( !vos_VolumeRelease( (void *) cellHandle, NULL, (unsigned int) volID,
+                          force, &ast )) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VolumeRelease
-       ((void *)cellHandle, NULL, (unsigned int)volID, force, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -515,34 +532,39 @@ Java_org_openafs_jafs_Volume_release(JNIEnv * env, jclass cls,
  *                    be dumped
  * jdumpFile   the full path of the file to which to dump
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_dump(JNIEnv * env, jclass cls, jint cellHandle,
-                                 jint serverHandle, jint partition,
-                                 jint volID, jint startTime,
-                                 jstring jdumpFile)
-{
-    afs_status_t ast;
-    char *dumpFile;
-
-    if (jdumpFile != NULL) {
-       dumpFile = getNativeString(env, jdumpFile);
-       if (!dumpFile) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLARG);
-       return;
-    }
-
-    if (!vos_VolumeDump
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int *)&partition, (unsigned int)volID,
-        (unsigned int)startTime, dumpFile, &ast)) {
-       throwAFSException(env, ast);
-    }
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_dump (JNIEnv *env, jclass cls, 
+                                     jlong cellHandle, jlong serverHandle, 
+                                     jint partition, jint volID, 
+                                     jint startTime, jstring jdumpFile) {
+
+  afs_status_t ast;
+  const char *dumpFile;
+
+  if( jdumpFile != NULL ) {
+    dumpFile = (*env)->GetStringUTFChars(env, jdumpFile, 0);
+    if( !dumpFile ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    dumpFile = NULL;
+  }
+
+  if( !vos_VolumeDump( (void *) cellHandle, (void *) serverHandle, NULL, 
+                      (unsigned int *) &partition, (unsigned int) volID, 
+                      (unsigned int) startTime, dumpFile, &ast ) ) {
+    if( dumpFile != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jdumpFile, dumpFile);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( dumpFile != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jdumpFile, dumpFile);
+  }
 
-    free(dumpFile);
 }
 
 /**
@@ -563,63 +585,74 @@ Java_org_openafs_jafs_Volume_dump(JNIEnv * env, jclass cls, jint cellHandle,
  *                     indicate the current position of the existing volume),
  *                     otherwise restores a full dump
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_restore(JNIEnv * env, jclass cls,
-                                    jint cellHandle, jint serverHandle,
-                                    jint partition, jint volID,
-                                    jstring jvolName, jstring jdumpFile,
-                                    jboolean incremental)
-{
-    afs_status_t ast;
-    char *volName;
-    char *dumpFile;
-    int *volumeIDp;
-    vos_volumeRestoreType_t vrt;
-
-    if (jvolName != NULL) {
-       volName = getNativeString(env, jvolName);
-       if (!volName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLVOLUME);
-       return;
-    }
-
-    if (jdumpFile != NULL) {
-       dumpFile = getNativeString(env, jdumpFile);
-       if (!dumpFile) {
-           free(volName);
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       dumpFile = NULL;
-    }
-
-    if (volID == 0) {
-       volumeIDp = NULL;
-    } else {
-       volumeIDp = (int *)&volID;
-    }
-
-    if (incremental) {
-       vrt = VOS_RESTORE_INCREMENTAL;
-    } else {
-       vrt = VOS_RESTORE_FULL;
-    }
-
-    if (!vos_VolumeRestore
-       ((void *)cellHandle, (void *)serverHandle, NULL,
-        (unsigned int)partition, (unsigned int *)volumeIDp, volName,
-        dumpFile, vrt, &ast)) {
-       throwAFSException(env, ast);
-    }
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_restore (JNIEnv *env, jclass cls, 
+                                        jlong cellHandle, jlong serverHandle, 
+                                        jint partition, jint volID, 
+                                        jstring jvolName, jstring jdumpFile, 
+                                        jboolean incremental) {
+
+  afs_status_t ast;
+  const char *volName;
+  const char *dumpFile;
+  int *volumeIDp;
+  vos_volumeRestoreType_t vrt;
+
+  if( jvolName != NULL ) {
+    volName = (*env)->GetStringUTFChars(env, jvolName, 0);
+    if( !volName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    volName = NULL;
+  }
+
+  if( jdumpFile != NULL ) {
+    dumpFile = (*env)->GetStringUTFChars(env, jdumpFile, 0);
+    if( !dumpFile ) {
+      if( volName != NULL ) {
+       (*env)->ReleaseStringUTFChars(env, jvolName, volName);
+      }
+      throwAFSException( env, JAFSADMNOMEM );
+      return;    
+    }
+  } else {
+    dumpFile = NULL;
+  }
+
+  if( volID == 0 ) {
+    volumeIDp = NULL;
+  } else {
+    volumeIDp = (int *) &volID;
+  }
+  
+  if( incremental ) {
+    vrt = VOS_RESTORE_INCREMENTAL;
+  } else {
+    vrt = VOS_RESTORE_FULL;
+  }
+
+  if( !vos_VolumeRestore( (void *) cellHandle, (void *) serverHandle, NULL, 
+                         (unsigned int) partition, (unsigned int *) volumeIDp,
+                         volName, dumpFile, vrt, &ast ) ) {
+    if( volName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jvolName, volName);
+    }
+    if( dumpFile != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jdumpFile, dumpFile);
+    }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( dumpFile != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jdumpFile, dumpFile);
+  }
+  if( volName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jvolName, volName);
+  }
 
-    if (dumpFile != NULL)
-       free(dumpFile);
-    free(volName);
 }
 
 /**
@@ -631,30 +664,37 @@ Java_org_openafs_jafs_Volume_restore(JNIEnv * env, jclass cls,
  * volId  the numeric id of the read-write volume to rename
  * jnewName  the new name for the volume
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_rename(JNIEnv * env, jclass cls, jint cellHandle,
-                                   jint volID, jstring jnewName)
-{
-    afs_status_t ast;
-    char *newName;
-
-    if (jnewName != NULL) {
-       newName = getNativeString(env, jnewName);
-       if (!newName) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLVOLUME);
-       return;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_rename (JNIEnv *env, jclass cls, 
+                                       jlong cellHandle, jint volID, 
+                                       jstring jnewName) {
+
+  afs_status_t ast;
+  const char *newName;
+
+  if( jnewName != NULL ) {
+    newName = (*env)->GetStringUTFChars(env, jnewName, 0);
+    if( !newName ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
     }
+  } else {
+    newName = NULL;
+  }
 
-    if (!vos_VolumeRename
-       ((void *)cellHandle, NULL, (unsigned int)volID, newName, &ast)) {
-       throwAFSException(env, ast);
+  if( !vos_VolumeRename( (void *) cellHandle, NULL, (unsigned int) volID, 
+                        newName, &ast ) ) {
+    if( newName != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jnewName, newName);
     }
+    throwAFSException( env, ast );
+    return;
+  }
+
+  if( newName != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jnewName, newName);
+  }
 
-    free(newName);
 }
 
 /**
@@ -672,27 +712,28 @@ Java_org_openafs_jafs_Volume_rename(JNIEnv * env, jclass cls, jint cellHandle,
  * offline   ?  (not sure what this is either, probably the current 
  *                     status of the volume -- busy or offline)
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_mount(JNIEnv * env, jclass cls,
-                                  jint serverHandle, jint partition,
-                                  jint volID, jint sleepTime,
-                                  jboolean offline)
-{
-    afs_status_t ast;
-    vos_volumeOnlineType_t volumeStatus;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_mount (JNIEnv *env, jclass cls, 
+                                      jlong serverHandle, jint partition, 
+                                      jint volID, jint sleepTime, 
+                                      jboolean offline) {
+
+  afs_status_t ast;
+  vos_volumeOnlineType_t volumeStatus;
+
+  if( offline ) {
+    volumeStatus = VOS_ONLINE_OFFLINE;
+  } else {
+    volumeStatus = VOS_ONLINE_BUSY;
+  }
+
+  if( !vos_VolumeOnline( (void *) serverHandle, NULL, (unsigned int) partition,
+                        (unsigned int) volID, (unsigned int) sleepTime, 
+                        volumeStatus, &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (offline) {
-       volumeStatus = VOS_ONLINE_OFFLINE;
-    } else {
-       volumeStatus = VOS_ONLINE_BUSY;
-    }
-
-    if (!vos_VolumeOnline
-       ((void *)serverHandle, NULL, (unsigned int)partition,
-        (unsigned int)volID, (unsigned int)sleepTime, volumeStatus, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -706,19 +747,20 @@ Java_org_openafs_jafs_Volume_mount(JNIEnv * env, jclass cls,
  *                    resides
  * volId  the numeric id of the volume to bring offline
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_unmount(JNIEnv * env, jclass cls,
-                                    jint serverHandle, jint partition,
-                                    jint volID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_unmount (JNIEnv *env, jclass cls, 
+                                        jlong serverHandle, jint partition, 
+                                        jint volID) {
+
+  afs_status_t ast;
+
+  if( !vos_VolumeOffline( (void *) serverHandle, NULL, 
+                         (unsigned int) partition, (unsigned int) volID, 
+                         &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VolumeOffline
-       ((void *)serverHandle, NULL, (unsigned int)partition,
-        (unsigned int)volID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -729,17 +771,18 @@ Java_org_openafs_jafs_Volume_unmount(JNIEnv * env, jclass cls,
  * cellHandle  the handle of the cell on which the volume resides
  * volId  the numeric id of the volume to lock
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_lock(JNIEnv * env, jclass cls, jint cellHandle,
-                                 jint volID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_lock (JNIEnv *env, jclass cls, 
+                                     jlong cellHandle, jint volID ) {
+
+  afs_status_t ast;
+
+  if( !vos_VLDBEntryLock( (void *) cellHandle, NULL, (unsigned int) volID, 
+                         &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VLDBEntryLock
-       ((void *)cellHandle, NULL, (unsigned int)volID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -750,17 +793,18 @@ Java_org_openafs_jafs_Volume_lock(JNIEnv * env, jclass cls, jint cellHandle,
  * cellHandle  the handle of the cell on which the volume resides
  * volId  the numeric id of the volume to unlock
  */
-JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_unlock(JNIEnv * env, jclass cls, jint cellHandle,
-                                   jint volID)
-{
-    afs_status_t ast;
+JNIEXPORT void JNICALL 
+Java_org_openafs_jafs_Volume_unlock (JNIEnv *env, jclass cls, 
+                                       jlong cellHandle, jint volID) {
+
+  afs_status_t ast;
+
+  if( !vos_VLDBEntryUnlock( (void *) cellHandle, NULL, (unsigned int) volID, 
+                           &ast ) ) {
+    throwAFSException( env, ast );
+    return;
+  }
 
-    if (!vos_VLDBEntryUnlock
-       ((void *)cellHandle, NULL, (unsigned int)volID, &ast)) {
-       throwAFSException(env, ast);
-       return;
-    }
 }
 
 /**
@@ -778,52 +822,80 @@ Java_org_openafs_jafs_Volume_unlock(JNIEnv * env, jclass cls, jint cellHandle,
  *              org_openafs_jafs_Volume_VOLUME_TYPE_BACKUP
  * returns   the id of the volume in question
  */
-JNIEXPORT jint JNICALL
-Java_org_openafs_jafs_Volume_translateNameToID(JNIEnv * env, jclass cls,
-                                              jint cellHandle, jstring jname,
-                                              jint type)
-{
-    afs_status_t ast;
-    char *name;
-    vos_vldbEntry_t vldbEntry;
-
-    if (jname != NULL) {
-       name = getNativeString(env, jname);
-       if (!name) {
-           throwAFSException(env, JAFSADMNOMEM);
-           return -1;
-       }
-    } else {
-       throwAFSException(env, JAFSNULLVOLUME);
-       return -1;
-    }
-
-    // get the id
-    if (!vos_VLDBGet((void *)cellHandle, NULL, NULL, name, &vldbEntry, &ast)) {
-       free(name);
-       throwAFSException(env, ast);
-       return -1;
-    }
-
-    free(name);
-
-    if (type == org_openafs_jafs_Volume_VOLUME_TYPE_READ_WRITE) {
-       return vldbEntry.volumeId[VOS_READ_WRITE_VOLUME];
-    } else if (type == org_openafs_jafs_Volume_VOLUME_TYPE_READ_ONLY) {
-       return vldbEntry.volumeId[VOS_READ_ONLY_VOLUME];
-    } else {
-       return vldbEntry.volumeId[VOS_BACKUP_VOLUME];
-    }
+JNIEXPORT jint JNICALL 
+Java_org_openafs_jafs_Volume_translateNameToID (JNIEnv *env, jclass cls, 
+                                                  jlong cellHandle, 
+                                                  jstring jname, jint type) {
+
+  afs_status_t ast;
+  const char *name;
+  vos_vldbEntry_t vldbEntry;
+
+  if( jname != NULL ) {
+    name = (*env)->GetStringUTFChars(env, jname, 0);
+    if( !name ) {
+       throwAFSException( env, JAFSADMNOMEM );
+       return;    
+    }
+  } else {
+    name = NULL;
+  }
+
+  // get the id
+  if( !vos_VLDBGet( (void *) cellHandle, NULL, NULL, name, 
+                   &vldbEntry, &ast ) ) {
+    if( name != NULL ) {
+      (*env)->ReleaseStringUTFChars(env, jname, name);
+    }
+    throwAFSException( env, ast );
+    return -1;
+  } 
+
+  if( name != NULL ) {
+    (*env)->ReleaseStringUTFChars(env, jname, name);
+  }
+
+  if( type == org_openafs_jafs_Volume_VOLUME_TYPE_READ_WRITE ) {
+    return vldbEntry.volumeId[VOS_READ_WRITE_VOLUME];
+  } else if( type == org_openafs_jafs_Volume_VOLUME_TYPE_READ_ONLY ) {
+    return vldbEntry.volumeId[VOS_READ_ONLY_VOLUME];
+  } else {
+    return vldbEntry.volumeId[VOS_BACKUP_VOLUME];
+  }
 
 }
 
 
 // reclaim global memory being used by this portion
 JNIEXPORT void JNICALL
-Java_org_openafs_jafs_Volume_reclaimVolumeMemory(JNIEnv * env, jclass cls)
-{
-    if (volumeCls) {
-       (*env)->DeleteGlobalRef(env, volumeCls);
-       volumeCls = 0;
-    }
+Java_org_openafs_jafs_Volume_reclaimVolumeMemory (JNIEnv *env, jclass cls) {
+
+  if( volumeCls ) {
+      (*env)->DeleteGlobalRef(env, volumeCls);
+      volumeCls = 0;
+  }
+
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index f4fb244..169909b 100644 (file)
@@ -568,7 +568,7 @@ case $AFS_SYSNAME in
 
        s390x_linux24|s390x_linux26)
                CC="gcc"
-               CCOBJ="gcc"
+               CCOBJ="gcc -fPIC"
                LD="ld"
                KERN_OPTMZ=-O2
                LEX="flex -l"
index c1a998c..588edb2 100644 (file)
@@ -17,7 +17,13 @@ include @TOP_OBJDIR@/src/config/Makefile.config
 # System specific build commands and flags
 DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
 KOPTS=
-CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG}
+SYS_NAME=@AFS_SYSNAME@
+ifeq (${SYS_NAME}, ppc64_linux26)
+CFLAGS=-fPIC
+else
+CFLAGS=
+endif
+CFLAGS+= -I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG}
 OPTF=-O
 # WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD