wt.load
Class LoadFromFile
java.lang.Object
wt.load.LoadFromFile
- public class LoadFromFile
- extends Object
USAGE:
java wt.load.LoadFromFile -m filename -d filename -o filename -t token
-g method -u user -p password
The LoadFromFile loads test case data into Windchill.
The -t token option sets the token string that is the set of delimiters
between the fields on one line of data in the file. Each line of the file
is a record and each token on a line is one attribute. If the token is not
found on the command line the default is set to wt.load.defaultToken from
wt.properties. If there is no wt.load.defaultToken in wt.properties the
default is hard coded to ','. The -m filename argument is the name of the map
file for mapping the attribute names to the values in the data file and
defining the method to be called for the class/generic method pair. If the
map file is not found on the command line the default is set to
wt.load.defaultMapFile from wt.properties. If there is no
wt.load.defaultMapFile in wt.properties the default is hard coded to look
for csvmapfile.txt in the wt.home.loadFiles directory. The -d filename argument
is required. It is the name of the data file to read in and parse. The
-g method argument is the generic method that should be performed on all of
the classes in the data file. This combined with the class name (the first
field on each line of the data file) determine which line from the map file
will be used to set the method to be called and the ordering of the rest of
the fields in a line of data. The -o filename argument is where the messages
from the server side processing are sent. If output file is not found on the
command line the default is to LoadFromFile.log in the directory wt.logs.dir
defined in wt.properties. If there is no wt.logs.dir in wt.properties the
default is hard coded to LoadFromFile.log in the current directory. The -o
option is currently not implemented.
The -u and -p optional arguments allow the user to pass the authentication
information via the command line instead of entering them in the authentication
window. If the arguments passed fail the authentication, user will be prompted
to authenticate using the pop up window.
There is a variable number of other parameters which can be added depending
on the method that will be called from the map file. These arguements follow
the - format. These values can then be used to substitute
in the data file. The token in the data file to be replaced must be preceded
by a '&' or a token on the command line must be defined ie. '-substitute &'.
...,&username,... with -username "Carrie Gruber" would substitute to
...,Carrie Gruber,...
Supported API: true
Method Summary |
static void |
doFileImport(String data_filename,
String map_filename,
String out_filename,
String token,
String method,
String user,
Hashtable cmd_line)
Method used by other methods to load data into the Windchill system. |
static void |
doFileLoad(String data_filename,
String out_filename,
String method,
String user,
Hashtable cmd_line)
Method used by other methods to load data into the Windchill system. |
static void |
doFileLoad(String data_filename,
String map_filename,
String out_filename,
String token,
String method,
String user,
Hashtable cmd_line)
Method used by other methods to load data into the Windchill system. |
static void |
doLoadFileSet(String loadFileSet,
String loadFileSetDescr,
String[] args)
This method will load a single file set. |
static void |
main(String[] args)
Command line method to load data into the Windchill system. |
private static void |
printUsage()
Print help message on usage of command line method. |
private static String |
validateDataFilename(String data_filename)
Validate the data filename string by trying to read the file. |
private static String |
validateMapFilename(String map_filename)
Validate the map filename string by trying to read the file. |
private static String |
validateMethod(String method)
Validate the method string. |
private static String |
validateOutFilename(String out_filename)
Validate the out filename string by trying to read the file. |
private static String |
validateToken(String token)
Validate the token string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RESOURCE
private static final String RESOURCE
- See Also:
- Constant Field Values
LoadFromFile
public LoadFromFile()
main
public static void main(String[] args)
throws WTException
- Command line method to load data into the Windchill system.
- Parameters:
args
- Parameters passed in on the command line.
- Throws:
WTException
-
Supported API: true
validateDataFilename
private static String validateDataFilename(String data_filename)
throws WTException
- Validate the data filename string by trying to read the file. Returns the validated
full pathname of the file.
- Parameters:
data_filename
- The data filename.
- Throws:
WTException
-
Supported API: false
validateMapFilename
private static String validateMapFilename(String map_filename)
throws WTException
- Validate the map filename string by trying to read the file. Returns the validated
full pathname of the file. If a the string passed in is null the method will
try to get wt.load.defaultMapFile from wt.properties. If that is also null then
it will default to wt.home.loadFiles.csvmapfile.txt.
- Parameters:
map_filename
- The map filename.
- Throws:
WTException
-
Supported API: false
validateOutFilename
private static String validateOutFilename(String out_filename)
throws WTException
- Validate the out filename string by trying to read the file. Returns the validated
full pathname of the file. Not implemented yet.
- Parameters:
out_filename
- The out filename.
- Throws:
WTException
-
Supported API: false
validateToken
private static String validateToken(String token)
throws WTException
- Validate the token string. If the string is null attempt to get wt.load.defaultToken
from wt.properties. If that is also null return ','.
- Parameters:
token
- The token used as a separater in the datafile.
- Throws:
WTException
-
Supported API: false
validateMethod
private static String validateMethod(String method)
- Validate the method string. If the string is null default to 'create'.
- Parameters:
method
- The method used with the object type to index into the map file.
Supported API: false
doFileLoad
public static void doFileLoad(String data_filename,
String out_filename,
String method,
String user,
Hashtable cmd_line)
- Method used by other methods to load data into the Windchill system. The user
should be an authenticated user before calling this method.
- Parameters:
data_filename
- Full pathname of file with data to be loaded.out_filename
- Not currently implemented. To be a trace or recovery file.method
- A string used with the object name (the first field) from the data file to key into the mapdata file. The line in the map data file will then contain the method name to pass this information to and the ordered list of fieldnames to match with the line in the data file.user
- The user to execute the method, if no user is given in the line from the data file.cmd_line
- Name/Value variables that can be substituted into the data from the data file.
Supported API: true
doFileLoad
public static void doFileLoad(String data_filename,
String map_filename,
String out_filename,
String token,
String method,
String user,
Hashtable cmd_line)
- Method used by other methods to load data into the Windchill system. The user
should be an authenticated user before calling this method.
- Parameters:
data_filename
- Full pathname of file with data to be loaded.out_filename
- Not currently implemented. To be a trace or recovery file.method
- A string used with the object name (the first field) from the data file to key into the mapdata file. The line in the map data file will then contain the method name to pass this information to and the ordered list of fieldnames to match with the line in the data file.user
- The user to execute the method, if no user is given in the line from the data file.cmd_line
- Name/Value variables that can be substituted into the data from the data file.
Supported API: true
doFileImport
public static void doFileImport(String data_filename,
String map_filename,
String out_filename,
String token,
String method,
String user,
Hashtable cmd_line)
throws WTException
- Method used by other methods to load data into the Windchill system. The user
should be an authenticated user before calling this method. This method is very similar to doFileLoad.
The only difference is that this method throws the exceptions.
- Parameters:
data_filename
- Full pathname of file with data to be loaded.map_filename
- Full pathname of file with mapping of attribute names to sequence of data in the data file.out_filename
- Not currently implemented. To be a trace or recovery file.token
- The token used to delimit fields of data in the data file.method
- A string used with the object name (the first field) from the data file to key into the mapdata file. The line in the map data file will then contain the method name to pass this information to and the ordered list of fieldnames to match with the line in the data file.user
- The user to execute the method, if no user is given in the line from the data file.cmd_line
- Name/Value variables that can be substituted into the data from the data file.
Supported API: true
- Throws:
WTException
doLoadFileSet
public static void doLoadFileSet(String loadFileSet,
String loadFileSetDescr,
String[] args)
throws WTException
- This method will load a single file set.
- Parameters:
loadFileSet
- File name of load set file.loadFileSetDescr
- Description of load set file.args
- Miscellaneous arguments which are passed to BasicLoader 'as is'. This may include UNATTENDED (-UAOps) and -NOSERVERSTOP
- Throws:
WTException
printUsage
private static void printUsage()
- Print help message on usage of command line method.
Supported API: false