diff options
Diffstat (limited to 'base/java-tools/src/com')
6 files changed, 226 insertions, 1 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/CACLI.java b/base/java-tools/src/com/netscape/cmstools/cli/CACLI.java new file mode 100644 index 000000000..c97dbd7ba --- /dev/null +++ b/base/java-tools/src/com/netscape/cmstools/cli/CACLI.java @@ -0,0 +1,54 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2013 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +package com.netscape.cmstools.cli; + +import com.netscape.certsrv.ca.CAClient; +import com.netscape.certsrv.client.Client; +import com.netscape.cmstools.user.UserCLI; + +/** + * @author Endi S. Dewata + */ +public class CACLI extends SubsystemCLI { + + public CAClient caClient; + + public CACLI(CLI parent) { + super("ca", "CA management commands", parent); + + addModule(new UserCLI(this)); + } + + public void init() throws Exception { + client = parent.getClient(); + caClient = new CAClient(client); + } + + public void login() { + caClient.login(); + } + + public void logout() { + caClient.logout(); + } + + public Client getClient(String name) { + return caClient.getClient(name); + } +} diff --git a/base/java-tools/src/com/netscape/cmstools/cli/KRACLI.java b/base/java-tools/src/com/netscape/cmstools/cli/KRACLI.java new file mode 100644 index 000000000..0249d876a --- /dev/null +++ b/base/java-tools/src/com/netscape/cmstools/cli/KRACLI.java @@ -0,0 +1,54 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2013 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +package com.netscape.cmstools.cli; + +import com.netscape.certsrv.client.Client; +import com.netscape.certsrv.kra.KRAClient; +import com.netscape.cmstools.user.UserCLI; + +/** + * @author Endi S. Dewata + */ +public class KRACLI extends SubsystemCLI { + + public KRAClient kraClient; + + public KRACLI(CLI parent) { + super("kra", "KRA management commands", parent); + + addModule(new UserCLI(this)); + } + + public void init() throws Exception { + client = parent.getClient(); + kraClient = new KRAClient(client); + } + + public void login() { + kraClient.login(); + } + + public void logout() { + kraClient.logout(); + } + + public Client getClient(String name) { + return kraClient.getClient(name); + } +} diff --git a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java index 7625e2f47..fcdb03ef4 100644 --- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java @@ -67,13 +67,17 @@ public class MainCLI extends CLI { public MainCLI() throws Exception { super("pki", "PKI command-line interface"); + addModule(new CACLI(this)); addModule(new CertCLI(this)); addModule(new ClientCLI(this)); addModule(new GroupCLI(this)); addModule(new KeyCLI(this)); + addModule(new KRACLI(this)); addModule(new KRAConnectorCLI(this)); + addModule(new OCSPCLI(this)); addModule(new ProfileCLI(this)); addModule(new SecurityDomainCLI(this)); + addModule(new TKSCLI(this)); addModule(new TPSCLI(this)); addModule(new UserCLI(this)); } diff --git a/base/java-tools/src/com/netscape/cmstools/cli/OCSPCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/OCSPCLI.java new file mode 100644 index 000000000..7a0be1c3f --- /dev/null +++ b/base/java-tools/src/com/netscape/cmstools/cli/OCSPCLI.java @@ -0,0 +1,54 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2013 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +package com.netscape.cmstools.cli; + +import com.netscape.certsrv.client.Client; +import com.netscape.certsrv.ocsp.OCSPClient; +import com.netscape.cmstools.user.UserCLI; + +/** + * @author Endi S. Dewata + */ +public class OCSPCLI extends SubsystemCLI { + + public OCSPClient ocspClient; + + public OCSPCLI(CLI parent) { + super("ocsp", "OCSP management commands", parent); + + addModule(new UserCLI(this)); + } + + public void init() throws Exception { + client = parent.getClient(); + ocspClient = new OCSPClient(client); + } + + public void login() { + ocspClient.login(); + } + + public void logout() { + ocspClient.logout(); + } + + public Client getClient(String name) { + return ocspClient.getClient(name); + } +} diff --git a/base/java-tools/src/com/netscape/cmstools/cli/TKSCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/TKSCLI.java new file mode 100644 index 000000000..0117432fe --- /dev/null +++ b/base/java-tools/src/com/netscape/cmstools/cli/TKSCLI.java @@ -0,0 +1,54 @@ +// --- BEGIN COPYRIGHT BLOCK --- +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; version 2 of the License. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// (C) 2013 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- + +package com.netscape.cmstools.cli; + +import com.netscape.certsrv.client.Client; +import com.netscape.certsrv.tks.TKSClient; +import com.netscape.cmstools.user.UserCLI; + +/** + * @author Endi S. Dewata + */ +public class TKSCLI extends SubsystemCLI { + + public TKSClient tksClient; + + public TKSCLI(CLI parent) { + super("tks", "TKS management commands", parent); + + addModule(new UserCLI(this)); + } + + public void init() throws Exception { + client = parent.getClient(); + tksClient = new TKSClient(client); + } + + public void login() { + tksClient.login(); + } + + public void logout() { + tksClient.logout(); + } + + public Client getClient(String name) { + return tksClient.getClient(name); + } +} diff --git a/base/java-tools/src/com/netscape/cmstools/user/UserCLI.java b/base/java-tools/src/com/netscape/cmstools/user/UserCLI.java index 4f6d11ac3..6cf0a4d52 100644 --- a/base/java-tools/src/com/netscape/cmstools/user/UserCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/user/UserCLI.java @@ -69,7 +69,12 @@ public class UserCLI extends CLI { public void execute(String[] args) throws Exception { client = parent.getClient(); - userClient = new UserClient(client); + userClient = (UserClient)parent.getClient("user"); + + if (userClient == null) { + // if parent doesn't have user client then create a new one + userClient = new UserClient(client); + } if (args.length == 0) { printHelp(); |
