>From f9b461b78032e1b232037ae7420828f90935b51a Mon Sep 17 00:00:00 2001
From: Christina Fu <cfu@redhat.com>
Date: Fri, 29 May 2015 15:47:02 -0700
Subject: [PATCH] Ticket 867 Need to support TPS as a separate tomcat instance.
  This patch addressed the issue that TPS on independent Tomcat is missing 
 symlink to symkey.jar and causes all symkey method reference to fail

---
 base/server/etc/default.cfg                                       | 2 --
 .../python/pki/server/deployment/scriptlets/instance_layout.py    | 8 --------
 base/tps/src/CMakeLists.txt                                       | 2 +-
 specs/pki-core.spec                                               | 5 +++++
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/base/server/etc/default.cfg b/base/server/etc/default.cfg
index 58f338692ac4f1c2637b575e27db2bec6254905b..0d3e41bbb029872f2e6a6c2d4efd98604a5159a4 100644
--- a/base/server/etc/default.cfg
+++ b/base/server/etc/default.cfg
@@ -261,7 +261,6 @@ pki_nsutil_jar_link=%(pki_tomcat_webapps_subsystem_webinf_lib_path)s/pki-nsutil.
 # These are used in the processing of pkispawn and are not supposed
 # to be overwritten by user configuration files
 pki_jss_jar=%(jni_jar_dir)s/jss4.jar
-pki_symkey_jar=%(jni_jar_dir)s/symkey.jar
 pki_apache_commons_collections_jar=/usr/share/java/apache-commons-collections.jar
 pki_apache_commons_io_jar=/usr/share/java/apache-commons-io.jar
 pki_apache_commons_lang_jar=/usr/share/java/apache-commons-lang.jar
@@ -285,7 +284,6 @@ pki_xerces_j2_jar=/usr/share/java/xerces-j2.jar
 pki_xml_commons_apis_jar=/usr/share/java/xml-commons-apis.jar
 pki_xml_commons_resolver_jar=/usr/share/java/xml-commons-resolver.jar
 pki_jss_jar_link=%(pki_tomcat_common_lib_path)s/jss4.jar
-pki_symkey_jar_link=%(pki_tomcat_common_lib_path)s/symkey.jar
 pki_apache_commons_collections_jar_link=%(pki_tomcat_common_lib_path)s/apache-commons-collections.jar
 pki_apache_commons_io_jar_link=%(pki_tomcat_common_lib_path)s/apache-commons-io.jar
 pki_apache_commons_lang_jar_link=%(pki_tomcat_common_lib_path)s/apache-commons-lang.jar
diff --git a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
index 62e3879425ffafeb78eeec3ec2c0db6a24f0627c..b5f849ad49b94e8d23a9b951cad47e01348d496e 100644
--- a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
+++ b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
@@ -286,11 +286,6 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                 deployer.mdict['pki_instance_log_path'],
                 deployer.mdict['pki_instance_logs_link'])
 
-        if deployer.mdict['pki_subsystem'] == 'TKS':
-            deployer.symlink.create(
-                deployer.mdict['pki_symkey_jar'],
-                deployer.mdict['pki_symkey_jar_link'])
-
         return self.rv
 
     def destroy(self, deployer):
@@ -298,9 +293,6 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
         config.pki_log.info(log.INSTANCE_DESTROY_1, __name__,
                             extra=config.PKI_INDENTATION_LEVEL_1)
 
-        if deployer.mdict['pki_subsystem'] == 'TKS':
-            deployer.symlink.delete(deployer.mdict['pki_symkey_jar_link'])
-
         if len(deployer.instance.tomcat_instance_subsystems()) == 0:
             # remove Tomcat instance base
             deployer.directory.delete(deployer.mdict['pki_instance_path'])
diff --git a/base/tps/src/CMakeLists.txt b/base/tps/src/CMakeLists.txt
index b36a01526613937e9e60e7ca4d26ae9db4946e2c..b8b13a9934b376cf283b7c6d35c3c4548ce843eb 100644
--- a/base/tps/src/CMakeLists.txt
+++ b/base/tps/src/CMakeLists.txt
@@ -137,7 +137,7 @@ javac(pki-tps-classes
     OUTPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     DEPENDS
-        pki-nsutil-jar pki-cmsutil-jar pki-certsrv-jar pki-cms-jar pki-cmscore-jar
+        symkey-jar pki-nsutil-jar pki-cmsutil-jar pki-certsrv-jar pki-cms-jar pki-cmscore-jar
 )
 
 configure_file(
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index 4dbae3b7bbb9c405df850f8eccdb316beeb0e086..4a083928d6aa88e25e8339c292a6a8b6ad46a0ff 100644
--- a/specs/pki-core.spec
+++ b/specs/pki-core.spec
@@ -686,6 +686,11 @@ for subsystem in ca kra ocsp tks tps; do
     ln -s %{_javadir}/pki/pki-$subsystem.jar %{buildroot}%{_datadir}/pki/$subsystem/webapps/$subsystem/WEB-INF/lib
 done
 
+# Create symkey symlink for TPS and TKS
+# ...WEB-INF/lib should already have been created
+for subsystem in tks tps; do
+    ln -s %{_jnidir}/symkey.jar %{buildroot}%{_datadir}/pki/$subsystem/webapps/$subsystem/WEB-INF/lib
+done
 
 %if %{with server}
 
-- 
1.8.4.2

