com.ibm.tspaces.services.utility
Class Migrate

java.lang.Object
  |
  +--com.ibm.tspaces.services.utility.Migrate

public class Migrate
extends java.lang.Object
implements java.lang.Runnable

This class implements a TupleSpace Migrate facility that will mgrate the TupleSpaces from one server to another server.

Usually this migration is because a new version of the TSpaces code is being installed and we need to have a way to copy all of the Tuples from one server to another without having problems because the TSpaces server class files have been updated.

The Migrate process is run in two steps:
TSpacesServerV1 -> Migrate Old -> directory
directory -> Migrate New -> TSpacesServerV2

The 1st parameter to Migrate "old" or "new" determines if we are going from the server to a set of files or from files to a server.

The 2nd parameter is the userid/password for the Admin user.

The 3nd parameter is the directory where the files are to be written to or read from.

The Host name for the server can also be specified at "-h hostname"

The user is responsible for setting up the classpath. When the Migrate Old process is run, then the classpath should specify the "tspaces.jar" file for the old version of the Server.
One would then bring down the old server and then start the new server. When then running the Migrate New process, the classpath must specify the "tspaces.jar" file for the new version of the server.

NOTE: The "tspaces.jar" must be used, not the "tspaces_client.jar"
Normally the above will be done by a script. See bin\migrate.bat or bin/migrate.sh

 The Migrate Old process is as follows.   
   - Access the Admin space and read the ACL entries. 
   - For each Space
     - Create a file with the same name as the space 
     - Write the Acl entry to the file.
     - Read the ConfigTuple from the Galaxy space if present
       and write it to the file. (V2.1.0 only)
     - Do a scan for all Tuples.
     - Write the results of the scan to the file.
     - Do a scan for all Subclassable Tuples.
     - Write the results of the scan to the file.
     - close the file.
   
 The Migrate New process is as follows:
    - For each file in the directory.
      - Read the 1st Tuple and build an ACL Entry. 
      - Read the config Tuple and use it when 
        creating the new Space
      - Read the Tuples and Subclassable Tuples and
        write them using multiWrite.
      - Rewrite the ACL entry for this space.

 The Admin space is handled differently.  When doing the 
 migrate old, the acldbase tule and usertable tuple are read 
 from the admin space and saved in the file.  
 When doing the migrate new, if the "-A" flag is specified then the 
 ACLDBase Tuple and the UserTable tuple are rewritten to the space.

Author:
John Thomas
See Also:
Tuple, Field, TupleSpace

Field Summary
static java.lang.String Migrate_TSHOST
          Default host for Migrate Space
static java.lang.String Migrate_TSNAME
          Default name for the Migrate Space
 
Constructor Summary
Migrate(java.lang.String tsName)
          Create a Migrate object.
 
Method Summary
static void main(java.lang.String[] argv)
          The starting point of execution for the Migrate thread We will parse the command line Usage: Migrate [-D] [-h tsHost] [-n tsName] [number] number = the number of Migrate threads to start.
 void run()
          The starting point of execution for each space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Migrate_TSNAME

public static final java.lang.String Migrate_TSNAME
Default name for the Migrate Space

Migrate_TSHOST

public static final java.lang.String Migrate_TSHOST
Default host for Migrate Space
Constructor Detail

Migrate

public Migrate(java.lang.String tsName)
Create a Migrate object. We store the TupleSpace host name and space name for use by the run method.
Parameters:
tsName - the TupleSpace where the work Tuples are stored.
tsHost - the Host name whene the space is found
i - the index of the thread.
See Also:
TupleSpace
Method Detail

run

public void run()
The starting point of execution for each space. The run method is invoked for each space that is to be migrated. It either call runOld() or runNew() depending on whether we are reading the Old server or writing to the new Server.
Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] argv)
The starting point of execution for the Migrate thread We will parse the command line Usage: Migrate [-D] [-h tsHost] [-n tsName] [number] number = the number of Migrate threads to start. Default is 2 We then create the specified number of instances of Migrate and then (since Migrate implements Runnable) we start a thread for each instance.