Администрирование предприятия > Загрузка данных Windchill > Introduction to Data Loading and the LoadFromFile Framework > Overview of Load Utilities
  
Overview of Load Utilities
Migrating legacy data into a new Windchill implementation is a fundamental requirement of any system implementation, but historically, it has been a labor-intensive manual task. The same can be said about merging information from a new acquisition into a PDM environment, including Windchill.
PTC offers the LoadFromFile framework to help with these activities.
The wt.load package is a set of framework utilities for loading demonstration or test data. It can be expanded to load new classes. The LoadFromFile utility can be called from both the command line and from other classes.
About the LoadFromFile Framework
The Windchill LoadFromFile framework performs the work of reading data from files and converting it to name-value pairs (represented as Hashtable), which are processed by the object loaders. In addition, the load framework provides some helper methods, which can be used by the loaders. Object loaders perform the actual work of creating the object, setting attributes on it, and persisting it to the database.
The framework uses some classes from the import/export framework. However, in most cases, the worker classes (that is, object loaders for load and object handlers for import and export) are separate and expect data in different XML format. In other words, the XML schema is different.
LoadFromFile is a framework that can be used to load data into your own site classes. The wt.doc.LoadDoc.java source file is included as an example of how to use the load package.
LoadFromFile in the main or command line call, or the doFileLoad method call, use the following parameters to load data into the system:
Data File (required)—Contains data to be loaded and resides on the method server host. The data file is a required parameter. If the string is null or not on the command line, the load fails. It is recommended that you include the full path name of the file. If the full path is not provided, the method attempts to read the file in the directory in which the load was started.
User (optional)—Specifies the user to execute the method if no user is given in the line from the data file.
The command line does not use the -u user option so no user is preset. The main in LoadFromFile calls SessionHelper.manager.getPrincipal() to prompt for a user and perform the authentication. The doFileLoad still has the user passed in, but it can be null. Demo and Developer authenticate before they call doFileLoad. It is recommended that you authenticate a user before calling doFileLoad, because it does not authenticate the user. The user would eventually be authenticated when the server side attempts to setPrincipal using the user passed in from doFileLoad, but the error messaging is best handled on the client side before calling doFileLoad.
User Password (optional)—Specifies the password for the authenticating user.
CONT_PATH—Specifies the target container for the data. The default target container is Exchange.
To run LoadFromFile from the command line, be sure that the server manager and method server are running and then call:
windchill wt.load.LoadFromFile -d c:\ptc\Windchill\loadfiles\ReqDocs.xml
-CONT_PATH \
"/wt.inf.container.OrgContainer=TST/wt.pdmlink.PDMLinkProduct=part 4\"
In this command, the .xml file is the load file that you want to use to load data.
You can use this utility to load a single, customized data file to the Windchill database, thereby allowing to easily create or migrate large amount of legacy data into a new Windchill implementation. For more information about this utility, see Using the LoadFromFile Utility.
* 
The load utilities process only XML files. The CSV2XML utility is used to convert CSV files to XML-formatted files. If your data is CSV-formatted, you can reformat it to XML using the CSV2XML utility before loading the data into the database. For more information, see Converting CSV Files to XML Format Files.
About the Windchill Loader
The Windchill Loader can load data for any of the installed Windchill solutions. The utility obtains a list of the installed solutions from the installed.properties file, which is updated when a solution is installed, and the loadsets for the base and demonstration data from the LoaderConfiguration.properties file. The loadsets are XML files that list the data files that must be loaded to support a Windchill solution.
Each solution has its own set of base and demonstration data. There is also a base data set, also called a foundation, that applies to all of the solutions. The foundation base data is automatically installed along with the solution-specific base data.
In addition to initializing the database, the load utility will also add users and groups to the LDAP directory services as specified in the wt.federation.ie.ldapServer property setting in the wt.properties file.
For more information about the Windchill Loader and for instructions on initializing and populating the Windchill database with test data, see the Windchill Installation and Configuration Guide (Руководство по установке и настройке Windchill).
About the LoadFromFile and LoadFileSet Utilities
In addition to the demonstration data that PTC provides, you may also have legacy data that you would like to add to the Windchill database. PTC provides two utilities to load legacy data:
LoadFromFile—Loads a single, legacy data file into the database
LoadFileSet—Loads multiple data files
The load utilities process only XML files. You can use the CSV2XML utility to convert CSV files to XML formatted files.
For more information about these utilities, see Loading Legacy Data Using the LoadFromFile and LoadFileSet Utilities.