|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.prefs.PreferenceExport
This class is used to export values from the Preference Backing Store ( It should read from the Database, file etc. depending on the Preference Mapping ). The output of the export is the same as the load file input used, such that the Preferences for a given context could be exported and transported to a new system (such as an individual user's preferences). This will ease development, and migration of Preferences.
This class may either be instantiated directly or run from the console.
For command line arguments simply run
java wt.prefs.PreferenceExport
Nodes The nodes to select for export. The default is '*'
Context The contexts to select for export. The default is
WTPreferences.DEFAULT_CONTEXT
which are the system defaults.
Writer/Filename The name of the file to output the results to or
the BufferedWriter
to use for output. The default is null,
which will export results to the console (System.out)
To utilize this class within another class, the following sample could be
used. In it, the all preferences with the text content and part are searched
and returned for the System Default context. The output is placed in the
filename outfile.
String[] nodes = {"content","part"};
String[] context = {WTPreferences.DEFAULT_CONTEXT};
try {
PreferenceExport pe = new PreferenceExport("outfile",nodes,context);
pe.processExport( );
} catch (IOException e ) { e.printStackTrace(); }
Output Format
java wt.load.LoadFromFile -t '~' -d outfile -m csvmapfile.txt
csvmapfile.txt
is the file located in the Windchill/loadFiles directory
If the output file is not in the loadFiles directory then an explicit path will
need to be defined for the csvmapfile.txt
Field Summary | |
private BufferedWriter |
buf
The writer for outputing the export |
private String[] |
context
The default context list to export |
private String[] |
nodes
The default nodes to extract |
private String |
outFile
The filename for output (null is default which redirects to System.out) |
Constructor Summary | |
PreferenceExport()
This is the default constructor which unless the set methods are called will output all preferences for the default context to the System.out |
|
PreferenceExport(BufferedWriter buf,
String[] nodes,
String[] context)
This constructor sets the writer, the nodes and the search context for the Preference Export. |
|
PreferenceExport(String outFile,
String[] nodes,
String[] context)
This constructor sets the output file name, the nodes and the search context for the Preference Export. |
Method Summary | |
static void |
main(String[] args)
This method is the main method for running exports from the console. |
protected static String |
printCommandLineHelp()
This method is used by the command line export utility to print the help for the exporter. |
void |
processExport()
This method will perform the Preference Export. |
void |
setContext(String[] context)
This method will set the contexts to use for the Preference Export. |
void |
setNodes(String[] nodes)
This method will set the nodes to use for the Preference Export. |
void |
setOutputFilename(String file)
This method will set the output filename to use for the Preference Export. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private String[] nodes
private String[] context
private String outFile
private BufferedWriter buf
Constructor Detail |
public PreferenceExport()
public PreferenceExport(String outFile, String[] nodes, String[] context)
outFile
- The output filenamenodes
- The nodes to export from the preference tree.context
- The context to search preferences on.public PreferenceExport(BufferedWriter buf, String[] nodes, String[] context)
buf
- The buffered writer.nodes
- The nodes to export from the preference tree.context
- The context to search preferences on.Method Detail |
public void setNodes(String[] nodes)
nodes
- The nodes to exportpublic void setContext(String[] context)
public void setOutputFilename(String file)
file
- The filename to export to.public void processExport() throws IOException
IOException
- If there is an error opening or writing to the
Buffered Output Writer.public static void main(String[] args)
protected static String printCommandLineHelp()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |