Skip to content

Commit b328532

Browse files
Merge pull request #292 from oracle/issue-287-domain-library-absolute-paths
Issue 287 domain library absolute paths
2 parents 64aba95 + 6c14a75 commit b328532

File tree

7 files changed

+59
-19
lines changed

7 files changed

+59
-19
lines changed

core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
* The Universal Permissive License (UPL), Version 1.0
44
*/
55
package oracle.weblogic.deploy.util;
@@ -657,7 +657,7 @@ public List<String> listDomainLibLibraries() throws WLSDeployArchiveIOException
657657
/**
658658
* Extract the specified domain library to the specified location (e.g., $DOMAIN_HOME/lib).
659659
*
660-
* @param archivePath the name of the JAR to extract
660+
* @param archivePath the path of the library within the archive
661661
* @param extractToLocation the location to write the file
662662
* @throws WLSDeployArchiveIOException if an IOException occurred while extracting or writing the file
663663
* @throws IllegalArgumentException if the file or directory passed in does not exist
@@ -669,11 +669,7 @@ public void extractDomainLibLibrary(String archivePath, File extractToLocation)
669669
validateNonEmptyString(archivePath, "archivePath", METHOD);
670670
validateExistingDirectory(extractToLocation, "extractToLocation", getArchiveFileName(), METHOD);
671671

672-
String libPath = archivePath;
673-
if (!archivePath.startsWith(ARCHIVE_DOMLIB_TARGET_DIR)) {
674-
libPath = ARCHIVE_DOMLIB_TARGET_DIR + ZIP_SEP + archivePath;
675-
}
676-
extractFileFromZip(libPath, ARCHIVE_DOMLIB_TARGET_DIR, "", extractToLocation);
672+
extractFileFromZip(archivePath, ARCHIVE_DOMLIB_TARGET_DIR, "", extractToLocation);
677673
LOGGER.exiting(CLASS, METHOD);
678674
}
679675

core/src/main/python/create.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def validateRCUArgsAndModel(model_context, model):
367367
if model_context.get_domain_typedef().required_rcu():
368368
if not model_context.get_rcu_database() or not model_context.get_rcu_prefix():
369369
__logger.severe('WLSDPLY-12408', model_context.get_domain_type(), CommandLineArgUtil.RCU_DB_SWITCH,
370-
CommandLineArgUtil.RCU_PREFIX_SWITCH)
370+
CommandLineArgUtil.RCU_PREFIX_SWITCH)
371371
__clean_up_temp_files()
372372
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
373373

@@ -389,6 +389,8 @@ def main(args):
389389

390390
wlst_helper.silence()
391391

392+
exit_code = CommandLineArgUtil.PROG_OK_EXIT_CODE
393+
392394
try:
393395
model_context = __process_args(args)
394396
except CLAException, ex:
@@ -451,8 +453,11 @@ def main(args):
451453
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
452454

453455
__clean_up_temp_files()
456+
457+
tool_exit.end(model_context, exit_code)
454458
return
455459

460+
456461
if __name__ == "main":
457462
WebLogicDeployToolingVersion.logVersionInfo(_program_name)
458463
main(sys.argv)

core/src/main/python/wlsdeploy/tool/util/library_helper.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
"""
2-
Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
The Universal Permissive License (UPL), Version 1.0
44
"""
5-
6-
import wlsdeploy.util.dictionary_utils as dictionary_utils
5+
from java.io import File
6+
from oracle.weblogic.deploy.util import WLSDeployArchive
7+
from shutil import copy
78

89
from wlsdeploy.aliases.model_constants import DOMAIN_LIBRARIES
9-
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
1010
from wlsdeploy.exception import exception_helper
1111
from wlsdeploy.tool.util.alias_helper import AliasHelper
1212
from wlsdeploy.tool.util.archive_helper import ArchiveHelper
1313
from wlsdeploy.tool.util.wlst_helper import WlstHelper
1414

15+
import wlsdeploy.util.dictionary_utils as dictionary_utils
16+
1517

1618
class LibraryHelper(object):
1719
"""
@@ -51,9 +53,14 @@ def install_domain_libraries(self):
5153
raise ex
5254

5355
for domain_lib in domain_libs:
54-
self.logger.info('WLSDPLY-12215', domain_lib, self.domain_home,
55-
class_name=self.__class_name, method_name=_method_name)
56-
self.archive_helper.extract_domain_library(domain_lib)
56+
if WLSDeployArchive.isPathIntoArchive(domain_lib):
57+
self.logger.info('WLSDPLY-12215', domain_lib, self.domain_home,
58+
class_name=self.__class_name, method_name=_method_name)
59+
self.archive_helper.extract_domain_library(domain_lib)
60+
else:
61+
self.logger.info('WLSDPLY-12235', domain_lib, self.domain_home,
62+
class_name=self.__class_name, method_name=_method_name)
63+
self._copy_domain_library(domain_lib)
5764

5865
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
5966
return
@@ -78,3 +85,20 @@ def extract_classpath_libraries(self):
7885
class_name=self.__class_name, method_name=_method_name)
7986
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
8087
return
88+
89+
def _copy_domain_library(self, domain_lib):
90+
"""
91+
Copy the specified domain library to the domain's lib directory.
92+
:raises: BundleAwareException of the specified type: if an error occurs
93+
"""
94+
_method_name = '_copy_domain_library'
95+
96+
source_path = File(domain_lib).getAbsolutePath()
97+
target_dir = File(self.domain_home, 'lib').getPath()
98+
99+
try:
100+
copy(str(source_path), str(target_dir))
101+
except IOError:
102+
ex = exception_helper.create_create_exception('WLSDPLY-12234', source_path, target_dir)
103+
self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
104+
raise ex

core/src/main/python/wlsdeploy/tool/validate/validator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,10 @@ def __validate_path_tokens_attribute(self, attribute_name, attribute_value, mode
889889
elif value_data_type == 'string':
890890
attr_values.append(attribute_value)
891891

892+
else:
893+
# must be a list
894+
attr_values.extend(attribute_value)
895+
892896
for item_path in attr_values:
893897
validation_result = self.__validate_single_path_in_archive(item_path.strip(), attribute_name,
894898
model_folder_path, validation_result)

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,8 @@ WLSDPLY-12230=Creating placeholder for Coherence cluster {0}
10231023
WLSDPLY-12231=Apply Domain {0} domain level attributes
10241024
WLSDPLY-12232=Unable to configure the SecurityConfiguration in domain release {0} using weblogic-deploy {1}
10251025
WLSDPLY-12233=Target JRF deployments and resources to {0} {1}
1026+
WLSDPLY-12234=Unable to copy domain library {0} to directory {1}
1027+
WLSDPLY-12235=Installing domain library {0} to lib directory of {1}
10261028

10271029
# domain_typedef.py
10281030
WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3}

installer/src/main/bin/createDomain.cmd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@rem **************************************************************************
33
@rem createDomain.cmd
44
@rem
5-
@rem Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
5+
@rem Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
66
@rem The Universal Permissive License (UPL), Version 1.0
77
@rem
88
@rem NAME
@@ -271,7 +271,8 @@ IF NOT EXIST "%WLST%" (
271271
)
272272
:found_wlst
273273

274-
SET LOG_CONFIG_CLASS=oracle.weblogic.deploy.logging.WLSDeployLoggingConfig
274+
SET LOG_CONFIG_CLASS=oracle.weblogic.deploy.logging.WLSDeployCustomizeLoggingConfig
275+
SET WLSDEPLOY_LOG_HANDLER=oracle.weblogic.deploy.logging.SummaryHandler
275276
SET WLST_PROPERTIES=-Dcom.oracle.cie.script.throwException=true
276277
SET "WLST_PROPERTIES=-Djava.util.logging.config.class=%LOG_CONFIG_CLASS% %WLST_PROPERTIES%"
277278
SET "WLST_PROPERTIES=%WLST_PROPERTIES% %WLSDEPLOY_PROPERTIES%"
@@ -282,6 +283,9 @@ IF NOT DEFINED WLSDEPLOY_LOG_PROPERTIES (
282283
IF NOT DEFINED WLSDEPLOY_LOG_DIRECTORY (
283284
SET WLSDEPLOY_LOG_DIRECTORY=%WLSDEPLOY_HOME%\logs
284285
)
286+
IF NOT DEFINED WLSDEPLOY_LOG_HANDLERS (
287+
SET WLSDEPLOY_LOG_HANDLERS=%WLSDEPLOY_LOG_HANDLER%
288+
)
285289

286290
ECHO JAVA_HOME = %JAVA_HOME%
287291
ECHO WLST_EXT_CLASSPATH = %WLST_EXT_CLASSPATH%

installer/src/main/bin/createDomain.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# *****************************************************************************
33
# createDomain.sh
44
#
5-
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
5+
# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
66
# The Universal Permissive License (UPL), Version 1.0
77
#
88
# NAME
@@ -295,7 +295,8 @@ else
295295
fi
296296
fi
297297

298-
LOG_CONFIG_CLASS=oracle.weblogic.deploy.logging.WLSDeployLoggingConfig
298+
LOG_CONFIG_CLASS=oracle.weblogic.deploy.logging.WLSDeployCustomizeLoggingConfig
299+
WLSDEPLOY_LOG_HANDLER=oracle.weblogic.deploy.logging.SummaryHandler
299300
WLST_PROPERTIES=-Dcom.oracle.cie.script.throwException=true
300301
WLST_PROPERTIES="-Djava.util.logging.config.class=${LOG_CONFIG_CLASS} ${WLST_PROPERTIES} ${WLSDEPLOY_PROPERTIES}"
301302
export WLST_PROPERTIES
@@ -308,6 +309,10 @@ if [ "${WLSDEPLOY_LOG_DIRECTORY}" = "" ]; then
308309
WLSDEPLOY_LOG_DIRECTORY=${WLSDEPLOY_HOME}/logs; export WLSDEPLOY_LOG_DIRECTORY
309310
fi
310311

312+
if [ "${WLSDEPLOY_LOG_HANDLERS}" == "" ]; then
313+
WLSDEPLOY_LOG_HANDLERS=${WLSDEPLOY_LOG_HANDLER}; export WLSDEPLOY_LOG_HANDLERS
314+
fi
315+
311316
echo "JAVA_HOME = ${JAVA_HOME}"
312317
echo "WLST_EXT_CLASSPATH = ${WLST_EXT_CLASSPATH}"
313318
echo "CLASSPATH = ${CLASSPATH}"

0 commit comments

Comments
 (0)