>From 38bbca4cb21b659b0d61dcbd404f965481695596 Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Fri, 6 Jul 2012 17:39:39 -0400
Subject: [PATCH 37/38] Add Application files to list REST resources

---
 base/ca/src/CMakeLists.txt                         |    9 +++-
 .../ca/CertificateAuthorityApplication.java        |   57 ++++++++++++++++++++
 base/kra/src/CMakeLists.txt                        |    9 +++-
 .../kra/KeyRecoveryAuthorityApplication.java       |   52 ++++++++++++++++++
 base/ocsp/src/CMakeLists.txt                       |    9 +++-
 .../netscape/ocsp/OCSPAuthorityApplication.java    |   41 ++++++++++++++
 base/tks/src/CMakeLists.txt                        |   10 +++-
 .../com/netscape/tks/TKSAuthorityApplication.java  |   43 +++++++++++++++
 8 files changed, 226 insertions(+), 4 deletions(-)
 create mode 100644 base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java
 create mode 100644 base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java
 create mode 100644 base/ocsp/src/com/netscape/ocsp/OCSPAuthorityApplication.java
 create mode 100644 base/tks/src/com/netscape/tks/TKSAuthorityApplication.java

diff --git a/base/ca/src/CMakeLists.txt b/base/ca/src/CMakeLists.txt
index 12436f301c2476c46baddadcd955764ef78acd0f..cd0c352a8eb2e0791f53e259fab363864d860953 100644
--- a/base/ca/src/CMakeLists.txt
+++ b/base/ca/src/CMakeLists.txt
@@ -24,6 +24,12 @@ find_file(COMMONS_CODEC_JAR
         /usr/share/java
 )
 
+find_file(JAXRS_API_JAR
+    NAMES
+        jaxrs-api.jar
+    PATHS
+        /usr/share/java/resteasy
+)
 
 # identify java sources
 set(pki-ca_java_SRCS
@@ -34,6 +40,7 @@ set(pki-ca_java_SRCS
     com/netscape/ca/CRLIssuingPoint.java
     com/netscape/ca/CAPolicy.java
     com/netscape/ca/CertificateAuthority.java
+    com/netscape/ca/CertificateAuthorityApplication.java
 )
 
 
@@ -41,7 +48,7 @@ set(pki-ca_java_SRCS
 set(CMAKE_JAVA_INCLUDE_PATH
     ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR}
     ${PKI_CMSUTIL_JAR} ${PKI_NSUTIL_JAR}
-    ${LDAPJDK_JAR}
+    ${LDAPJDK_JAR} ${JAXRS_API_JAR}
     ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR})
 
 
diff --git a/base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java b/base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..a70a3600d6aa4123330e585bf824899ec6a1a3eb
--- /dev/null
+++ b/base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java
@@ -0,0 +1,57 @@
+package com.netscape.ca;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import com.netscape.cms.servlet.admin.GroupMemberResourceService;
+import com.netscape.cms.servlet.admin.GroupResourceService;
+import com.netscape.cms.servlet.admin.SystemCertificateResourceService;
+import com.netscape.cms.servlet.admin.UserCertResourceService;
+import com.netscape.cms.servlet.admin.UserResourceService;
+import com.netscape.cms.servlet.cert.CertResourceService;
+import com.netscape.cms.servlet.cert.CertsResourceService;
+import com.netscape.cms.servlet.csadmin.SystemConfigurationResourceService;
+import com.netscape.cms.servlet.profile.ProfileResourceService;
+import com.netscape.cms.servlet.profile.ProfilesResourceService;
+import com.netscape.cms.servlet.request.CertRequestResourceService;
+import com.netscape.cms.servlet.request.CertRequestsResourceService;
+
+public class CertificateAuthorityApplication extends Application {
+    private Set<Object> singletons = new HashSet<Object>();
+    private Set<Class<?>> classes = new HashSet<Class<?>>();
+
+    public CertificateAuthorityApplication() {
+        // installer
+        classes.add(SystemConfigurationResourceService.class);
+
+        // certs and requests
+        classes.add(CertsResourceService.class);
+        classes.add(CertResourceService.class);
+        classes.add(CertRequestsResourceService.class);
+        classes.add(CertRequestResourceService.class);
+
+        // profile management
+        classes.add(ProfileResourceService.class);
+        classes.add(ProfilesResourceService.class);
+
+        // user and group management
+        classes.add(GroupMemberResourceService.class);
+        classes.add(GroupResourceService.class);
+        classes.add(UserCertResourceService.class);
+        classes.add(UserResourceService.class);
+
+        // system certs
+        classes.add(SystemCertificateResourceService.class);
+    }
+
+    public Set<Class<?>> getClasses() {
+        return classes;
+    }
+
+    public Set<Object> getSingletons() {
+        return singletons;
+    }
+
+}
diff --git a/base/kra/src/CMakeLists.txt b/base/kra/src/CMakeLists.txt
index df7e1929b01e6f9165d2eee4baa11ed39672fc1b..71056ffa64ad963b62e4655079f407e586800a58 100644
--- a/base/kra/src/CMakeLists.txt
+++ b/base/kra/src/CMakeLists.txt
@@ -46,6 +46,12 @@ find_file(LDAPJDK_JAR
         /usr/share/java
 )
 
+find_file(JAXRS_API_JAR
+    NAMES
+        jaxrs-api.jar
+    PATHS
+        /usr/share/java/resteasy
+)
 
 # '${JAVA_LIB_INSTALL_DIR}' jars
 find_file(JSS_JAR
@@ -73,6 +79,7 @@ find_file(SYMKEY_JAR
 # identify java sources
 set(pki-kra_java_SRCS
     com/netscape/kra/KeyRecoveryAuthority.java
+    com/netscape/kra/KeyRecoveryAuthorityApplication.java
     com/netscape/kra/EnrollmentService.java
     com/netscape/kra/RecoveryService.java
     com/netscape/kra/SecurityDataRecoveryService.java
@@ -93,7 +100,7 @@ set(pki-kra_java_SRCS
 set(CMAKE_JAVA_INCLUDE_PATH
     ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR}
     ${PKI_CMSUTIL_JAR} ${PKI_NSUTIL_JAR}
-    ${LDAPJDK_JAR}
+    ${LDAPJDK_JAR} ${JAXRS_API_JAR}
     ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR})
 
 
diff --git a/base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java b/base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..c3c3e4f50c7597d8556512320ec19ced60b03915
--- /dev/null
+++ b/base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java
@@ -0,0 +1,52 @@
+package com.netscape.kra;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import com.netscape.cms.servlet.admin.GroupMemberResourceService;
+import com.netscape.cms.servlet.admin.GroupResourceService;
+import com.netscape.cms.servlet.admin.SystemCertificateResourceService;
+import com.netscape.cms.servlet.admin.UserCertResourceService;
+import com.netscape.cms.servlet.admin.UserResourceService;
+import com.netscape.cms.servlet.csadmin.SystemConfigurationResourceService;
+import com.netscape.cms.servlet.key.KeyResourceService;
+import com.netscape.cms.servlet.key.KeysResourceService;
+import com.netscape.cms.servlet.request.KeyRequestResourceService;
+import com.netscape.cms.servlet.request.KeyRequestsResourceService;
+
+public class KeyRecoveryAuthorityApplication extends Application {
+
+    private Set<Object> singletons = new HashSet<Object>();
+    private Set<Class<?>> classes = new HashSet<Class<?>>();
+
+    public KeyRecoveryAuthorityApplication() {
+        // installer
+        classes.add(SystemConfigurationResourceService.class);
+
+        // keys and keyrequests
+        classes.add(KeysResourceService.class);
+        classes.add(KeyResourceService.class);
+        classes.add(KeyRequestsResourceService.class);
+        classes.add(KeyRequestResourceService.class);
+
+        // user and group management
+        classes.add(GroupMemberResourceService.class);
+        classes.add(GroupResourceService.class);
+        classes.add(UserCertResourceService.class);
+        classes.add(UserResourceService.class);
+
+        // system certs
+        classes.add(SystemCertificateResourceService.class);
+    }
+
+    public Set<Class<?>> getClasses() {
+        return classes;
+    }
+
+    public Set<Object> getSingletons() {
+        return singletons;
+    }
+
+}
diff --git a/base/ocsp/src/CMakeLists.txt b/base/ocsp/src/CMakeLists.txt
index 0992eeaee7df9a43730399a6b35830b10666f6d5..6e0967c8228fde7f6f42e8639b1244bb67c46086 100644
--- a/base/ocsp/src/CMakeLists.txt
+++ b/base/ocsp/src/CMakeLists.txt
@@ -46,6 +46,12 @@ find_file(LDAPJDK_JAR
         /usr/share/java
 )
 
+find_file(JAXRS_API_JAR
+    NAMES
+        jaxrs-api.jar
+    PATHS
+        /usr/share/java/resteasy
+)
 
 # '${JAVA_LIB_INSTALL_DIR}' jars
 find_file(JSS_JAR
@@ -74,6 +80,7 @@ find_file(SYMKEY_JAR
 set(pki-ocsp_java_SRCS
     com/netscape/ocsp/OCSPResources.java
     com/netscape/ocsp/OCSPAuthority.java
+    com/netscape/ocsp/OCSPAuthorityApplication.java
     com/netscape/ocsp/SigningUnit.java
     com/netscape/ocsp/EOCSPException.java
 )
@@ -83,7 +90,7 @@ set(pki-ocsp_java_SRCS
 set(CMAKE_JAVA_INCLUDE_PATH
     ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR}
     ${PKI_CMSUTIL_JAR} ${PKI_NSUTIL_JAR}
-    ${LDAPJDK_JAR}
+    ${LDAPJDK_JAR} ${JAXRS_API_JAR}
     ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR})
 
 
diff --git a/base/ocsp/src/com/netscape/ocsp/OCSPAuthorityApplication.java b/base/ocsp/src/com/netscape/ocsp/OCSPAuthorityApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..c002347f1b520a20139ce0b789616090f5c8e314
--- /dev/null
+++ b/base/ocsp/src/com/netscape/ocsp/OCSPAuthorityApplication.java
@@ -0,0 +1,41 @@
+package com.netscape.ocsp;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import com.netscape.cms.servlet.admin.GroupMemberResourceService;
+import com.netscape.cms.servlet.admin.GroupResourceService;
+import com.netscape.cms.servlet.admin.SystemCertificateResourceService;
+import com.netscape.cms.servlet.admin.UserCertResourceService;
+import com.netscape.cms.servlet.admin.UserResourceService;
+import com.netscape.cms.servlet.csadmin.SystemConfigurationResourceService;
+
+public class OCSPAuthorityApplication extends Application {
+
+    private Set<Object> singletons = new HashSet<Object>();
+    private Set<Class<?>> classes = new HashSet<Class<?>>();
+
+    public OCSPAuthorityApplication() {
+        // installer
+        classes.add(SystemConfigurationResourceService.class);
+
+        // user and group management
+        classes.add(GroupMemberResourceService.class);
+        classes.add(GroupResourceService.class);
+        classes.add(UserCertResourceService.class);
+        classes.add(UserResourceService.class);
+
+        // system certs
+        classes.add(SystemCertificateResourceService.class);
+    }
+
+    public Set<Class<?>> getClasses() {
+        return classes;
+    }
+
+    public Set<Object> getSingletons() {
+        return singletons;
+    }
+}
diff --git a/base/tks/src/CMakeLists.txt b/base/tks/src/CMakeLists.txt
index 852ad7bf40e4e93cf382c2370cf5359a3c818e21..982dfedac9ce96dc281754f8e51b06154f719e5f 100644
--- a/base/tks/src/CMakeLists.txt
+++ b/base/tks/src/CMakeLists.txt
@@ -46,6 +46,13 @@ find_file(LDAPJDK_JAR
         /usr/share/java
 )
 
+find_file(JAXRS_API_JAR
+    NAMES
+        jaxrs-api.jar
+    PATHS
+        /usr/share/java/resteasy
+)
+
 
 # '${JAVA_LIB_INSTALL_DIR}' jars
 find_file(JSS_JAR
@@ -73,6 +80,7 @@ find_file(SYMKEY_JAR
 # identify java sources
 set(pki-tks_java_SRCS
     com/netscape/tks/TKSAuthority.java
+    com/netscape/tks/TKSAuthorityApplication.java
 )
 
 
@@ -80,7 +88,7 @@ set(pki-tks_java_SRCS
 set(CMAKE_JAVA_INCLUDE_PATH
     ${PKI_CERTSRV_JAR} ${PKI_CMS_JAR} ${PKI_CMSCORE_JAR}
     ${PKI_CMSUTIL_JAR} ${PKI_NSUTIL_JAR}
-    ${LDAPJDK_JAR}
+    ${LDAPJDK_JAR} ${JAXRS_API_JAR}
     ${JSS_JAR} ${COMMONS_CODEC_JAR} ${SYMKEY_JAR})
 
 
diff --git a/base/tks/src/com/netscape/tks/TKSAuthorityApplication.java b/base/tks/src/com/netscape/tks/TKSAuthorityApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..5ca5eb257b047daee2f3c6126ffc491672ed908f
--- /dev/null
+++ b/base/tks/src/com/netscape/tks/TKSAuthorityApplication.java
@@ -0,0 +1,43 @@
+package com.netscape.tks;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import com.netscape.cms.servlet.admin.GroupMemberResourceService;
+import com.netscape.cms.servlet.admin.GroupResourceService;
+import com.netscape.cms.servlet.admin.SystemCertificateResourceService;
+import com.netscape.cms.servlet.admin.UserCertResourceService;
+import com.netscape.cms.servlet.admin.UserResourceService;
+import com.netscape.cms.servlet.csadmin.SystemConfigurationResourceService;
+
+public class TKSAuthorityApplication extends Application {
+
+    private Set<Object> singletons = new HashSet<Object>();
+    private Set<Class<?>> classes = new HashSet<Class<?>>();
+
+    public TKSAuthorityApplication() {
+        // installer
+        classes.add(SystemConfigurationResourceService.class);
+
+        // user and group management
+        classes.add(GroupMemberResourceService.class);
+        classes.add(GroupResourceService.class);
+        classes.add(UserCertResourceService.class);
+        classes.add(UserResourceService.class);
+
+        // system certs
+        classes.add(SystemCertificateResourceService.class);
+    }
+
+    public Set<Class<?>> getClasses() {
+        return classes;
+    }
+
+    public Set<Object> getSingletons() {
+        return singletons;
+    }
+
+}
+
-- 
1.7.10.1

