>From 15b7873460494c0d976388086d1a5a9f9c23e6c1 Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Mon, 16 Jan 2012 10:05:47 -0500
Subject: [PATCH] Changes to pkicreate to create resteasy links.

Added resteasy-jettison-provider to pki-setup as it is not currently delivered
by candlepin-deps.
---
 pki/base/setup/CMakeLists.txt                      |   11 ++
 .../jars/resteasy-jettison-provider-2.3-RC1.jar    |  Bin 0 -> 32378 bytes
 pki/base/setup/pkicommon.pm                        |    6 +-
 pki/base/setup/pkicreate                           |  104 ++++++++++++++++++++
 pki/specs/pki-core.spec                            |   10 ++-
 5 files changed, 126 insertions(+), 5 deletions(-)
 create mode 100644 pki/base/setup/jars/resteasy-jettison-provider-2.3-RC1.jar

diff --git a/pki/base/setup/CMakeLists.txt b/pki/base/setup/CMakeLists.txt
index 05f18332ddddd8170709d97d969b109b41b0d0d0..2ed50ee6249c3d70c1075a1e572b4d7656ed2a0c 100644
--- a/pki/base/setup/CMakeLists.txt
+++ b/pki/base/setup/CMakeLists.txt
@@ -27,6 +27,17 @@ install(
         WORLD_EXECUTE WORLD_READ
 )
 
+install(
+    FILES
+        jars/resteasy-jettison-provider-2.3-RC1.jar
+    DESTINATION
+        ${JAVA_JAR_INSTALL_DIR}        
+    PERMISSIONS
+        OWNER_EXECUTE OWNER_WRITE OWNER_READ
+        GROUP_EXECUTE GROUP_READ
+        WORLD_EXECUTE WORLD_READ
+)
+
 # install empty directories
 install(CODE "file(MAKE_DIRECTORY \$ENV{DESTDIR}${VAR_INSTALL_DIR}/lock/pki)")
 install(CODE "file(MAKE_DIRECTORY \$ENV{DESTDIR}${VAR_INSTALL_DIR}/run/pki)")
diff --git a/pki/base/setup/jars/resteasy-jettison-provider-2.3-RC1.jar b/pki/base/setup/jars/resteasy-jettison-provider-2.3-RC1.jar
new file mode 100644
index 0000000000000000000000000000000000000000..da7106ddd97e2106c5397be45db78728f1adebdf
GIT binary patch
diff --git a/pki/base/setup/pkicommon.pm b/pki/base/setup/pkicommon.pm
index f8c304b916307dc897897ea980326fed87b0c79c..6ce255303ff802ec04fb5222925a42b1d8f1cc84 100755
--- a/pki/base/setup/pkicommon.pm
+++ b/pki/base/setup/pkicommon.pm
@@ -184,6 +184,7 @@ our $default_ldapmodify_command    = undef;
 our $default_modutil_command       = undef;
 our $default_initscripts_path      = undef;
 our $default_registry_path         = undef;
+my  $candlepin_java_path           = "/usr/share/candlepin/lib";
 
 our $default_dir_permissions       = 00770;
 our $default_exe_permissions       = 00770;
@@ -219,7 +220,7 @@ if ($^O eq "linux") {
         $default_java_path             = "/usr/share/java";
         $default_pki_java_path         = "/usr/share/java/pki";
         $default_system_jni_java_path  = "/usr/lib/java";
-        @default_jar_path = ($default_pki_java_path, $default_java_path, $default_system_jni_java_path);
+        @default_jar_path = ($default_pki_java_path, $default_java_path, $default_system_jni_java_path, $candlepin_java_path);
     } elsif ($default_hardware_platform eq "x86_64") {
         # 64-bit Linux
         $default_system_binaries       = "/bin";
@@ -230,7 +231,8 @@ if ($^O eq "linux") {
         $default_pki_java_path         = "/usr/share/java/pki";
         $default_x86_64_jni_java_path  = "/usr/lib64/java";
         $default_system_jni_java_path  = "/usr/lib/java";
-        @default_jar_path = ($default_pki_java_path, $default_java_path, $default_x86_64_jni_java_path, $default_system_jni_java_path);
+        @default_jar_path = ($default_pki_java_path, $default_java_path, $default_x86_64_jni_java_path,
+                             $default_system_jni_java_path, $candlepin_java_path);
     } else {
         emit("Unsupported '$^O' hardware platform '$default_hardware_platform'!", "error");
         exit 255;
diff --git a/pki/base/setup/pkicreate b/pki/base/setup/pkicreate
index 82da22cea3c28bbb8b882503cae93d73f35f5602..528c9a423885da0bb8ff1acd9904d24f8a123ddf 100755
--- a/pki/base/setup/pkicreate
+++ b/pki/base/setup/pkicreate
@@ -186,6 +186,15 @@ my $tomcatjss_jar_base_name       = "tomcatjss.jar";       # CA, KRA, OCSP, TKS
 my $velocity_jar_base_name        = "velocity.jar";        # CA, KRA, OCSP, TKS
 my $xerces_jar_base_name          = "xerces-j2.jar";       # CA, KRA, OCSP, TKS
 
+# resteasy jars
+my $javassist_jar_base_name       = "javassist-3.9.0.GA.jar";                      # CA, KRA, OCSP, TKS
+my $jaxrs_api_jar_base_name       = "jaxrs-api-2.2.1.GA.jar";                      # CA, KRA, OCSP, TKS
+my $resteasy_jaxb_provider_jar_base_name = "resteasy-jaxb-provider-2.2.1.GA.jar";  # CA, KRA, OCSP, TKS
+my $resteasy_jaxrs_jar_base_name  = "resteasy-jaxrs-2.2.1.GA.jar";                 # CA, KRA, OCSP, TKS
+my $scannotation_jar_base_name    = "scannotation-1.0.2.jar";                      # CA, KRA, OCSP, TKS
+my $jettison_jar_base_name        = "jettison.jar";                                # CA, KRA, OCSP, TKS
+my $resteasy_jettison_provider_jar_base_name = "resteasy-jettison-provider-2.3-RC1.jar"; # CA, KRA, OCSP, TKS
+
 my $apache_commons_collections_jar_base_name  = "apache-commons-collections.jar";
 my $jakarta_commons_collections_jar_base_name = "jakarta-commons-collections.jar";
 my $apache_commons_logging_jar_base_name  = "apache-commons-logging.jar";
@@ -465,6 +474,20 @@ my $pki_cmscore_jar_file_path                    = undef;  # CA, KRA, OCSP, TKS
 my $pki_cmscore_jar_symlink_path                 = undef;  # CA, KRA, OCSP, TKS
 my $pki_cmsutil_jar_file_path                    = undef;  # CA, KRA, OCSP, TKS
 my $pki_cmsutil_jar_symlink_path                 = undef;  # CA, KRA, OCSP, TKS
+my $javassist_jar_file_path                      = undef;  # CA, KRA, OCSP, TKS
+my $javassist_jar_symlink_path                   = undef;  # CA, KRA, OCSP, TKS
+my $jaxrs_api_jar_file_path                      = undef;  # CA, KRA, OCSP, TKS
+my $jaxrs_api_jar_symlink_path                   = undef;  # CA, KRA, OCSP, TKS
+my $resteasy_jaxb_provider_jar_file_path         = undef;  # CA, KRA, OCSP, TKS
+my $resteasy_jaxb_provider_jar_symlink_path      = undef;  # CA, KRA, OCSP, TKS
+my $resteasy_jaxrs_jar_file_path                 = undef;  # CA, KRA, OCSP, TKS
+my $resteasy_jaxrs_jar_symlink_path              = undef;  # CA, KRA, OCSP, TKS
+my $scannotation_jar_file_path                   = undef;  # CA, KRA, OCSP, TKS
+my $scannotation_jar_symlink_path                = undef;  # CA, KRA, OCSP, TKS
+my $jettison_jar_file_path                       = undef;  # CA, KRA, OCSP, TKS
+my $jettison_jar_symlink_path                    = undef;  # CA, KRA, OCSP, TKS
+my $resteasy_jettison_provider_jar_file_path     = undef;  # CA, KRA, OCSP, TKS
+my $resteasy_jettison_provider_jar_symlink_path  = undef;  # CA, KRA, OCSP, TKS
 my $commons_collections_jar_file_path            = undef;  # CA, KRA, OCSP, TKS
 my $commons_collections_jar_symlink_path         = undef;  # CA, KRA, OCSP, TKS
 my $commons_lang_jar_file_path                   = undef;  # CA, KRA, OCSP, TKS
@@ -1850,6 +1873,41 @@ sub initialize_subdirectory_paths
             return 0;
         }
 
+        if (!defined($javassist_jar_file_path = find_jar($javassist_jar_base_name))) {
+            emit("could not find jar: $javassist_jar_base_name", "error");
+            return 0;
+        }
+
+        if (!defined($jaxrs_api_jar_file_path = find_jar($jaxrs_api_jar_base_name))) {
+            emit("could not find jar: $jaxrs_api_jar_base_name", "error");
+            return 0;
+        }
+
+        if (!defined($resteasy_jaxb_provider_jar_file_path = find_jar($resteasy_jaxb_provider_jar_base_name))) {
+            emit("could not find jar: $resteasy_jaxb_provider_jar_base_name", "error");
+            return 0;
+        }
+
+        if (!defined($resteasy_jaxrs_jar_file_path = find_jar($resteasy_jaxrs_jar_base_name))) {
+            emit("could not find jar: $resteasy_jaxrs_jar_base_name", "error");
+            return 0;
+        }
+
+        if (!defined($scannotation_jar_file_path = find_jar($scannotation_jar_base_name))) {
+            emit("could not find jar: $scannotation_jar_base_name", "error");
+            return 0;
+        }
+
+        if (!defined($resteasy_jettison_provider_jar_file_path = find_jar($resteasy_jettison_provider_jar_base_name))) {
+            emit("could not find jar: $resteasy_jettison_provider_jar_base_name", "error");
+            return 0;
+        }
+
+        if (!defined($jettison_jar_file_path = find_jar($jettison_jar_base_name))) {
+            emit("could not find jar: $jettison_jar_base_name", "error");
+            return 0;
+        }
+
         $webinf_instance_path              = $webapps_instance_path
                                            . "/" . $subsystem_type
                                            . "/" . $webinf_base_instance_dir;
@@ -1903,6 +1961,22 @@ sub initialize_subdirectory_paths
         $xml_commons_resolver_jar_symlink_path = $webinf_lib_instance_path
                                            . "/" . $xml_commons_resolver_jar_base_name;
 
+        #resteasy
+        $javassist_jar_symlink_path                  = $webinf_lib_instance_path
+                                                     . "/" . $javassist_jar_base_name;
+        $jaxrs_api_jar_symlink_path                  = $webinf_lib_instance_path
+                                                     . "/" . $jaxrs_api_jar_base_name;
+        $resteasy_jaxb_provider_jar_symlink_path     = $webinf_lib_instance_path
+                                                     . "/" . $resteasy_jaxb_provider_jar_base_name;
+        $resteasy_jaxrs_jar_symlink_path             = $webinf_lib_instance_path
+                                                     . "/" . $resteasy_jaxrs_jar_base_name;
+        $scannotation_jar_symlink_path               = $webinf_lib_instance_path
+                                                     . "/" . $scannotation_jar_base_name;
+        $resteasy_jettison_provider_jar_symlink_path = $webinf_lib_instance_path
+                                                     . "/" . $resteasy_jettison_provider_jar_base_name;
+        $jettison_jar_symlink_path                   = $webinf_lib_instance_path
+                                                     . "/" . $jettison_jar_base_name;
+
 
         $webapps_root_instance_path        = $webapps_instance_path
                                            . "/"
@@ -2919,6 +2993,36 @@ sub process_pki_files_and_symlinks
         return 0 if !create_symlink($xml_commons_resolver_jar_symlink_path, $xml_commons_resolver_jar_file_path,
                                     $pki_user, $pki_group);
 
+        #resteasy
+        # create instance symlink to "javassist.jar"
+        return 0 if !create_symlink($javassist_jar_symlink_path, $javassist_jar_file_path,
+                                    $pki_user, $pki_group);
+
+        # create instance symlink to "jaxrs-api.jar"
+        return 0 if !create_symlink($jaxrs_api_jar_symlink_path, $jaxrs_api_jar_file_path,
+                                    $pki_user, $pki_group);
+
+        # create instance symlink to "pki-resteasy_jaxb_provider.jar"
+        return 0 if !create_symlink($resteasy_jaxb_provider_jar_symlink_path, $resteasy_jaxb_provider_jar_file_path,
+                                    $pki_user, $pki_group);
+
+        # create instance symlink to "resteasy_jaxrs.jar"
+        return 0 if !create_symlink($resteasy_jaxrs_jar_symlink_path, $resteasy_jaxrs_jar_file_path,
+                                    $pki_user, $pki_group);
+
+        # create instance symlink to "scannotation.jar"
+        return 0 if !create_symlink($scannotation_jar_symlink_path, $scannotation_jar_file_path,
+                                    $pki_user, $pki_group);
+
+        # create instance symlink to "pki-resteasy_jettison_provider.jar"
+        return 0 if !create_symlink($resteasy_jettison_provider_jar_symlink_path, $resteasy_jettison_provider_jar_file_path,
+                                    $pki_user, $pki_group);
+
+        # create instance symlink to "jettison.jar"
+        return 0 if !create_symlink($jettison_jar_symlink_path, $jettison_jar_file_path,
+                                    $pki_user, $pki_group);
+
+
     }
 
     return 1;
diff --git a/pki/specs/pki-core.spec b/pki/specs/pki-core.spec
index c9bb229a0d5af6621ce19b21ac4fe2148f7cb1db..de5353298a204dec8ab819313e55afb741eaafc7 100644
--- a/pki/specs/pki-core.spec
+++ b/pki/specs/pki-core.spec
@@ -1,6 +1,6 @@
 Name:             pki-core
 Version:          9.0.16
-Release:          2%{?dist}
+Release:          3%{?dist}
 Summary:          Certificate System - PKI Core Components
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -26,7 +26,7 @@ BuildRequires:    selinux-policy-devel
 BuildRequires:    velocity
 BuildRequires:    xalan-j2
 BuildRequires:    xerces-j2
-BuildRequires:    candlepin-deps
+BuildRequires:    candlepin-deps = 0.0.21-1
 %if 0%{?fedora} >= 16
 BuildRequires:    jpackage-utils >= 0:1.7.5-10
 BuildRequires:    jss >= 4.2.6-19.1
@@ -275,7 +275,7 @@ Group:            System Environment/Base
 BuildArch:        noarch
 
 Requires:         java >= 1:1.6.0
-Requires:         candlepin-deps
+Requires:         candlepin-deps = 0.0.21-1
 Requires:         javassist
 Requires:         jettison
 Requires:         pki-common-theme >= 9.0.0
@@ -595,6 +595,7 @@ fi
 %if 0%{?fedora} >= 16
 %{_bindir}/pkicontrol
 %endif
+%{_javadir}/resteasy-jettison-provider-2.3-RC1.jar
 
 
 %files -n pki-symkey
@@ -726,6 +727,9 @@ fi
 
 
 %changelog
+* Mon Jan 16 2012 Ade Lee <alee@redhat.com> 9.0.16-3
+- Added resteasy-jettison-provider-2.3-RC1.jar to pki-setup
+
 * Mon Nov 28 2011 Endi S. Dewata <edewata@redhat.com> 9.0.16-2
 - Added JUnit tests
  
-- 
1.7.6.4

