summaryrefslogtreecommitdiffstats
path: root/base/java-tools/src/com/netscape/cmstools/tps
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2014-03-17 11:40:42 -0400
committerEndi S. Dewata <edewata@redhat.com>2014-03-19 16:19:04 -0400
commitfbd1b96a35946b7ebf36afea3f3a2a50dcbf193f (patch)
treea8de6caa0be49b39321c546e02b35b6710299f1f /base/java-tools/src/com/netscape/cmstools/tps
parent4c02156a7cc336afcb2cb46f77d98097eb83cda1 (diff)
downloadpki-fbd1b96a35946b7ebf36afea3f3a2a50dcbf193f.tar.gz
pki-fbd1b96a35946b7ebf36afea3f3a2a50dcbf193f.tar.xz
pki-fbd1b96a35946b7ebf36afea3f3a2a50dcbf193f.zip
Added search filter for TPS resources.
The TPS resources have been modified to accept a basic search filter for find operation. For resources based on LDAP database, the filtering is done using LDAP filter. For other resources, the filtering is done using string comparison. For now the filter is will only be matched against entry IDs. In the future the filter may be expanded to support other entry attributes. The CLI has been updated accordingly. The total attribute in DataCollection was changed from Integer into int because the total size of the collection cannot be null. The PKIException constructors have been consolidated into a single actual constructor. The other constructors have been modified to call the actual constructor with some default values. Ticket #847
Diffstat (limited to 'base/java-tools/src/com/netscape/cmstools/tps')
-rw-r--r--base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorFindCLI.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/tps/cert/TPSCertFindCLI.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/tps/connection/ConnectionFindCLI.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileFindCLI.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileMappingFindCLI.java7
-rw-r--r--base/java-tools/src/com/netscape/cmstools/tps/token/TokenFindCLI.java7
6 files changed, 30 insertions, 12 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorFindCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorFindCLI.java
index 683d2891c..552fc3040 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorFindCLI.java
@@ -41,7 +41,7 @@ public class AuthenticatorFindCLI extends CLI {
}
public void printHelp() {
- formatter.printHelp(getFullName() + " [OPTIONS...]", options);
+ formatter.printHelp(getFullName() + " [FILTER] [OPTIONS...]", options);
}
public void execute(String[] args) throws Exception {
@@ -65,13 +65,16 @@ public class AuthenticatorFindCLI extends CLI {
System.exit(1);
}
+ String[] cmdArgs = cmd.getArgs();
+ String filter = cmdArgs.length > 0 ? cmdArgs[0] : null;
+
String s = cmd.getOptionValue("start");
Integer start = s == null ? null : Integer.valueOf(s);
s = cmd.getOptionValue("size");
Integer size = s == null ? null : Integer.valueOf(s);
- AuthenticatorCollection result = authenticatorCLI.authenticatorClient.findAuthenticators(start, size);
+ AuthenticatorCollection result = authenticatorCLI.authenticatorClient.findAuthenticators(filter, start, size);
MainCLI.printMessage(result.getTotal() + " entries matched");
if (result.getTotal() == 0) return;
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/cert/TPSCertFindCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/cert/TPSCertFindCLI.java
index 12ec1b9da..91c460bf6 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/cert/TPSCertFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/cert/TPSCertFindCLI.java
@@ -41,7 +41,7 @@ public class TPSCertFindCLI extends CLI {
}
public void printHelp() {
- formatter.printHelp(getFullName() + " [OPTIONS...]", options);
+ formatter.printHelp(getFullName() + " [FILTER] [OPTIONS...]", options);
}
public void execute(String[] args) throws Exception {
@@ -65,13 +65,16 @@ public class TPSCertFindCLI extends CLI {
System.exit(1);
}
+ String[] cmdArgs = cmd.getArgs();
+ String filter = cmdArgs.length > 0 ? cmdArgs[0] : null;
+
String s = cmd.getOptionValue("start");
Integer start = s == null ? null : Integer.valueOf(s);
s = cmd.getOptionValue("size");
Integer size = s == null ? null : Integer.valueOf(s);
- TPSCertCollection result = certCLI.certClient.findCerts(start, size);
+ TPSCertCollection result = certCLI.certClient.findCerts(filter, start, size);
MainCLI.printMessage(result.getTotal() + " entries matched");
if (result.getTotal() == 0) return;
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/connection/ConnectionFindCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/connection/ConnectionFindCLI.java
index d78727d7b..9d2165ef0 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/connection/ConnectionFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/connection/ConnectionFindCLI.java
@@ -41,7 +41,7 @@ public class ConnectionFindCLI extends CLI {
}
public void printHelp() {
- formatter.printHelp(getFullName() + " [OPTIONS...]", options);
+ formatter.printHelp(getFullName() + " [FILTER] [OPTIONS...]", options);
}
public void execute(String[] args) throws Exception {
@@ -65,13 +65,16 @@ public class ConnectionFindCLI extends CLI {
System.exit(1);
}
+ String[] cmdArgs = cmd.getArgs();
+ String filter = cmdArgs.length > 0 ? cmdArgs[0] : null;
+
String s = cmd.getOptionValue("start");
Integer start = s == null ? null : Integer.valueOf(s);
s = cmd.getOptionValue("size");
Integer size = s == null ? null : Integer.valueOf(s);
- ConnectionCollection result = connectionCLI.connectionClient.findConnections(start, size);
+ ConnectionCollection result = connectionCLI.connectionClient.findConnections(filter, start, size);
MainCLI.printMessage(result.getTotal() + " entries matched");
if (result.getTotal() == 0) return;
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileFindCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileFindCLI.java
index cabacaacd..251d14d23 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileFindCLI.java
@@ -41,7 +41,7 @@ public class ProfileFindCLI extends CLI {
}
public void printHelp() {
- formatter.printHelp(getFullName() + " [OPTIONS...]", options);
+ formatter.printHelp(getFullName() + " [FILTER] [OPTIONS...]", options);
}
public void execute(String[] args) throws Exception {
@@ -65,13 +65,16 @@ public class ProfileFindCLI extends CLI {
System.exit(1);
}
+ String[] cmdArgs = cmd.getArgs();
+ String filter = cmdArgs.length > 0 ? cmdArgs[0] : null;
+
String s = cmd.getOptionValue("start");
Integer start = s == null ? null : Integer.valueOf(s);
s = cmd.getOptionValue("size");
Integer size = s == null ? null : Integer.valueOf(s);
- ProfileCollection result = profileCLI.profileClient.findProfiles(start, size);
+ ProfileCollection result = profileCLI.profileClient.findProfiles(filter, start, size);
MainCLI.printMessage(result.getTotal() + " entries matched");
if (result.getTotal() == 0) return;
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileMappingFindCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileMappingFindCLI.java
index 9d87cc43c..e125629e6 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileMappingFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileMappingFindCLI.java
@@ -41,7 +41,7 @@ public class ProfileMappingFindCLI extends CLI {
}
public void printHelp() {
- formatter.printHelp(getFullName() + " [OPTIONS...]", options);
+ formatter.printHelp(getFullName() + " [FILTER] [OPTIONS...]", options);
}
public void execute(String[] args) throws Exception {
@@ -65,13 +65,16 @@ public class ProfileMappingFindCLI extends CLI {
System.exit(1);
}
+ String[] cmdArgs = cmd.getArgs();
+ String filter = cmdArgs.length > 0 ? cmdArgs[0] : null;
+
String s = cmd.getOptionValue("start");
Integer start = s == null ? null : Integer.valueOf(s);
s = cmd.getOptionValue("size");
Integer size = s == null ? null : Integer.valueOf(s);
- ProfileMappingCollection result = profileMappingCLI.profileMappingClient.findProfileMappings(start, size);
+ ProfileMappingCollection result = profileMappingCLI.profileMappingClient.findProfileMappings(filter, start, size);
MainCLI.printMessage(result.getTotal() + " entries matched");
if (result.getTotal() == 0) return;
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenFindCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenFindCLI.java
index 6cfb1fb00..22fbad944 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenFindCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenFindCLI.java
@@ -41,7 +41,7 @@ public class TokenFindCLI extends CLI {
}
public void printHelp() {
- formatter.printHelp(getFullName() + " [OPTIONS...]", options);
+ formatter.printHelp(getFullName() + " [FILTER] [OPTIONS...]", options);
}
public void execute(String[] args) throws Exception {
@@ -65,13 +65,16 @@ public class TokenFindCLI extends CLI {
System.exit(1);
}
+ String[] cmdArgs = cmd.getArgs();
+ String filter = cmdArgs.length > 0 ? cmdArgs[0] : null;
+
String s = cmd.getOptionValue("start");
Integer start = s == null ? null : Integer.valueOf(s);
s = cmd.getOptionValue("size");
Integer size = s == null ? null : Integer.valueOf(s);
- TokenCollection result = tokenCLI.tokenClient.findTokens(start, size);
+ TokenCollection result = tokenCLI.tokenClient.findTokens(filter, start, size);
MainCLI.printMessage(result.getTotal() + " entries matched");
if (result.getTotal() == 0) return;