diff options
author | Endi S. Dewata <edewata@redhat.com> | 2013-10-24 09:17:37 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2013-11-04 11:37:06 -0500 |
commit | 89d871642969572a0a64f2fa9d9455e0753fcf1c (patch) | |
tree | 2da14ad12a4a3388a3233bb5ce22a4f96af84171 /base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileCLI.java | |
parent | 481ee45823a6dd1d3d151f407eb78e142e7149fa (diff) | |
download | pki-89d871642969572a0a64f2fa9d9455e0753fcf1c.tar.gz pki-89d871642969572a0a64f2fa9d9455e0753fcf1c.tar.xz pki-89d871642969572a0a64f2fa9d9455e0753fcf1c.zip |
Added TPS profile resource.
A new REST service and clients have been added to manage the profiles
in the TPS configuration file.
Ticket #652
Diffstat (limited to 'base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileCLI.java')
-rw-r--r-- | base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileCLI.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileCLI.java index 41270f6f9..8b02f2e57 100644 --- a/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/tps/profile/ProfileCLI.java @@ -18,6 +18,13 @@ package com.netscape.cmstools.tps.profile; +import java.io.IOException; +import java.util.Map; + +import org.jboss.resteasy.plugins.providers.atom.Link; + +import com.netscape.certsrv.tps.profile.ProfileClient; +import com.netscape.certsrv.tps.profile.ProfileData; import com.netscape.cmstools.cli.CLI; /** @@ -25,16 +32,44 @@ import com.netscape.cmstools.cli.CLI; */ public class ProfileCLI extends CLI { + public ProfileClient profileClient; + public ProfileCLI(CLI parent) { super("profile", "Profile management commands", parent); + addModule(new ProfileAddCLI(this)); + addModule(new ProfileFindCLI(this)); + addModule(new ProfileModifyCLI(this)); + addModule(new ProfileRemoveCLI(this)); + addModule(new ProfileShowCLI(this)); + addModule(new ProfileMappingCLI(this)); } public void execute(String[] args) throws Exception { client = parent.getClient(); + profileClient = (ProfileClient)parent.getClient("profile"); super.execute(args); } + + public static void printProfileData(ProfileData profileData, boolean showProperties) throws IOException { + System.out.println(" Profile ID: " + profileData.getID()); + if (profileData.getStatus() != null) System.out.println(" Status: " + profileData.getStatus()); + + if (showProperties) { + System.out.println(" Properties:"); + Map<String, String> properties = profileData.getProperties(); + for (String name : properties.keySet()) { + String value = properties.get(name); + System.out.println(" " + name + ": " + value); + } + } + + Link link = profileData.getLink(); + if (verbose && link != null) { + System.out.println(" Link: " + link.getHref()); + } + } } |