|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectprotoj.lang.ConfigureFeature
public final class ConfigureFeature
Configures the project by overlaying the contents of a profile directory onto the project directory. A profile directory can have any content whatsoever, but usually it will contain a similar directory structure to the project itself and contain xml and property files that should replace those already existing in the project.
Also uniquely for properties files, any properties will automatically get merged with those where a a destination properties file already exists, with the profile properties taking precedence over the project properties. Here is an example of a profile called jonny for a hypothetical developer of the same name:
˜/dev/myproj/
|
|____bin/ copy will happen here
|
|____conf/ip-addresses.properties merge will happen here
| |
| |____profile/ create profiles under here
| |
| |____jonny/ an example profile directory
| |
| |____bin/useful-dev-script.sh
| |
| |____conf/ip-addresses.properties
|
|...
So jonny has a special script that he likes to use and therefore has placed
it in the bin directory under his profile. Also it seems also that the
project needs to know various ip addresses in order to work correctly.
Therefore he has placed his inside his conf directory, with the knowledge
that after configuration, his properties will get merged into the properties
file in the project directory and also take precedence.
Interpolated properties are also supported, which basically means all ${var} property placeholders get resolved during configuration in any text files specified in a profile. This can be especially useful for the many tools that are unable to interpolate properties at runtime for themselves. It's a good idea to set interpolation permanently on or off since the two modes aren't compatible. So the decision must be made at the API level at compile time by specifying true or false in the call to StandardProject.initConfig(). The following options are supported:
| Constructor Summary | |
|---|---|
ConfigureFeature(StandardProject project,
boolean interpolated)
Creates an instance with the owning parent project and also the plug-in runnable responsible for further configuration. |
|
| Method Summary | |
|---|---|
void |
configure(java.lang.String name)
Configures the project config directory by overlaying the content of the specified profile directory, merging any properties files en route. |
java.io.File |
getWorkingDir()
Temporary storage for configuration calculations. |
void |
undo(java.lang.String name)
Removes all files in the project directory that match the paths in the specified profile name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConfigureFeature(StandardProject project,
boolean interpolated)
project - interpolated - | Method Detail |
|---|
public java.io.File getWorkingDir()
public void configure(java.lang.String name)
When interpolate is specified to be true, all property references in all
files (including the properties files themselves in the profile conf
directory) are interpolated. This means every reference to ${var} is
replaced with the value calculated from the properties files.
Additionally the properties files are reduced to a single master
properties file - see ProjectLayout.getPropertiesFile().
name - public void undo(java.lang.String name)
name -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||