Skip to content

Commit

Permalink
rolling back removal of server.xml logic to compare server location a…
Browse files Browse the repository at this point in the history
…nd reload serverconfigdocument

Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Nov 11, 2024
1 parent a09d75f commit 01f1976
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,12 @@ protected void verifyAppStarted(String appFile) throws MojoExecutionException {
if (getAppsDirectory().equals("apps")) {

try {
File serverXML = new File(serverDirectory, "server.xml");

Map<String, File> libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles();
CommonLogger logger = new CommonLogger(getLog());
setLog(logger.getLog());
scd = getServerConfigDocument(logger, libertyDirPropertyFiles);
scd = getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles);

//appName will be set to a name derived from appFile if no name can be found.
appName = scd.findNameForLocation(appFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ protected void undeployApp(File file) throws MojoExecutionException {
if (getAppsDirectory().equals("apps")) {

try {
File serverXML = new File(serverDirectory.getCanonicalPath(), "server.xml");

Map<String, File> libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles();
CommonLogger logger = new CommonLogger(getLog());
setLog(logger.getLog());
scd = getServerConfigDocument(logger, libertyDirPropertyFiles);
scd = getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles);

//appName will be set to a name derived from file if no name can be found.
appName = scd.findNameForLocation(appName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ protected Set<String> getAppConfigLocationsFromSourceServerXml() {
Map<String, File> libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles();
CommonLogger logger = new CommonLogger(getLog());
setLog(logger.getLog());
scd = getServerConfigDocument(logger, libertyDirPropertyFiles);
scd = getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles);
} catch (Exception e) {
getLog().warn(e.getLocalizedMessage());
getLog().debug(e);
Expand All @@ -383,8 +383,8 @@ protected Set<String> getAppConfigLocationsFromSourceServerXml() {
return scd != null ? scd.getLocations() : new HashSet<String>();
}

protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, Map<String, File> libertyDirPropertyFiles) {
if (scd == null) {
protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, Map<String, File> libertyDirPropertyFiles) throws IOException {
if (scd == null || !scd.getServerXML().getCanonicalPath().equals(serverXML.getCanonicalPath())) {
scd = new ServerConfigDocument(log, libertyDirPropertyFiles);
}

Expand Down

0 comments on commit 01f1976

Please sign in to comment.