|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ptc.windchill.structconf.StructConfManager
Tools for manipulating declarative and site xconf settings, propagating xconfs into property files, updating property documentation, and locating property specifications in xconf files.
This class has a
interface which provides for all facilities
on the command line. To see how to use the class via this interface invoke
the command:
main
java com.ptc.windchill.structconf.StructConfManager -h
For programmatic usage, see the documentation for the method
.
execute
Field Summary | |
private static String |
BREAK_AND_INDENT
|
private TargetFileContentsCollector |
collector_
|
private boolean |
lenientValidation_
|
private static int |
MAX_WRAPPED_MESSAGE_WIDTH
|
private RebuildAnalyzer |
rebuildAnalyzer_
|
private boolean |
targetUnix_
|
private HashMap |
updaters_
|
Constructor Summary | |
StructConfManager()
Create instance that will use the JVM's file separator to determine the target platform. |
|
StructConfManager(boolean target_unix)
A configurable constructor. |
Method Summary | |
static void |
convertLeadingLongDashesToRegularDashes(String[] args)
|
void |
execute(Collection commands)
See execute(StructConfManagerCommand[]) . |
void |
execute(StructConfManagerCommand[] commands)
Execute a sequence of StructConfManagerCommands . |
(package private) TargetFileContentsCollector |
getCollector()
|
(package private) UpdateXconf |
getDeclarativeUpdater()
|
(package private) UpdateXconf |
getSiteUpdater()
|
(package private) UpdateXconf |
getUpdater(File file,
int xconf_parser_mode)
|
private static boolean |
isPlatformUnix()
|
private static String |
localize(String key)
|
static void |
main(String[] args)
Command line interface to the StructConfManager. |
private static ArrayList |
parsePropertyNames(String value)
|
private static String[] |
parsePropertyNameValuePair(String arg)
|
XconfAnalysis |
propagate(boolean force_propagate,
boolean force_xconf_scan)
Shorthand for creating and executing a Propagate command. |
private void |
saveSettings()
|
private void |
saveUpdaterSettings(UpdateXconf updater,
String updater_desc)
|
void |
setLenientValidation(boolean lenient)
Configure whether validation of xconf data is lenient. |
private static void |
showHelp()
|
private static void |
showHelp(String error_message)
|
private static ArrayList |
split(String message)
|
private static File |
validateFile(String opt,
String key_for_does_not_exist,
String key_for_cannot_be_read)
|
private static String |
wrap(String message)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean lenientValidation_
private boolean targetUnix_
private RebuildAnalyzer rebuildAnalyzer_
private TargetFileContentsCollector collector_
private HashMap updaters_
private static final String BREAK_AND_INDENT
private static final int MAX_WRAPPED_MESSAGE_WIDTH
Constructor Detail |
public StructConfManager()
public StructConfManager(boolean target_unix)
target_unix
- Set whether or not to generate properties in unix or windows format. This is useful when cross propagating, i.e. generating properties for a different platform than that which the propagator is running on.Method Detail |
private static boolean isPlatformUnix()
TargetFileContentsCollector getCollector() throws StructConfManagerException
StructConfManagerException
public void setLenientValidation(boolean lenient)
UpdateXconf getDeclarativeUpdater()
UpdateXconf getSiteUpdater()
UpdateXconf getUpdater(File file, int xconf_parser_mode)
public XconfAnalysis propagate(boolean force_propagate, boolean force_xconf_scan) throws InvalidXconfException, PartialPropagationException, TargetFilesWriteProtectedException, StructConfManagerException
Propagate
command.
i.e. it is the equivalent of:
StructConfManager manager = ...; manager.execute(new StructConfManagerCommand[] { new Propagate(...) });
InvalidXconfException
- if the xconf's contain errors that prevent propagation from occurring (see InvalidXconfException.getXconfAnalysis()
for warnings and errors)
PartialPropagationException
- if propgation updates one or more, but not all target files and fails - this exception contains detailed information about what files need to be restored and which backup files to use
TargetFilesWriteProtectedException
- if propagation cannot be started because one or more target files are not writable - this exception will contain the list of files that are write protected.
StructConfManagerException
- all other exceptions related to illogical date or IO errorspublic void execute(StructConfManagerCommand[] commands) throws StructConfManagerException
StructConfManagerCommands
.
All commands will be executed and any changes made to xconf files
will be saved.
If Propagate
command are encountered, all
modified xconf files will be saved before propagation occurs.
It is valid to intersperse Propagate
commands with other
commands, although this will take more time.
Example Usage:
The following examples will install a new declarative xconf file, set a site-specific value for a property, and propate the changes to properties files:
StructConfManager manager = new StructConfManager(); StructConfManagerCommand[] commands = new StructConfManagerCommand[] { new IncludeXconfFile( "codebase/com/ptc/windchill/myassembly/mycomponent/foo.xconf", true), new SetSiteProperty("foo.dir", "/opt/foo"), new Propagate() }; manager.execute(commands);Alternatively, you may provide a collection rather than an array:
StructConfManager manager = new StructConfManager(); ArrayList commands = new ArrayList(); commands.add(new IncludeXconfFile( "codebase/com/ptc/windchill/myassembly/mycomponent/foo.xconf", true)); commands.add(new SetSiteProperty("foo.dir", "/opt/foo")); commands.add(new Propagate()); manager.execute(commands);
StructConfManagerException
StructConfManagerCommand
public void execute(Collection commands) throws StructConfManagerException
execute(StructConfManagerCommand[])
.
StructConfManagerException
private void saveSettings() throws StructConfManagerException
StructConfManagerException
private void saveUpdaterSettings(UpdateXconf updater, String updater_desc) throws StructConfManagerException
StructConfManagerException
private static void showHelp()
private static String localize(String key)
private static String wrap(String message)
private static ArrayList split(String message)
private static void showHelp(String error_message)
private static ArrayList parsePropertyNames(String value)
private static String[] parsePropertyNameValuePair(String arg) throws IOException
IOException
public static void convertLeadingLongDashesToRegularDashes(String[] args)
private static File validateFile(String opt, String key_for_does_not_exist, String key_for_cannot_be_read)
public static void main(String[] args)
For usage information, execute:
java -cp ... com.ptc.windchill.structconf.propagate.Propagate -hat the command prompt.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |