diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-11 09:47:39 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-08-15 12:07:43 -0500 |
commit | 1aa02e5207514d210e903d23e1d698b85fc29344 (patch) | |
tree | 3bd555aed82c2446208444939594aac3e3979308 /base/common/src/com/netscape/cms/servlet/key | |
parent | 3c9b8e787ccf066c38469e1fe2c119d5c410bb5e (diff) | |
download | pki-1aa02e5207514d210e903d23e1d698b85fc29344.tar.gz pki-1aa02e5207514d210e903d23e1d698b85fc29344.tar.xz pki-1aa02e5207514d210e903d23e1d698b85fc29344.zip |
Reorganized REST common classes.
The common classes used by REST client and services have been moved
into the com.netscape.certsrv.<component> packages.
Ticket #215
Diffstat (limited to 'base/common/src/com/netscape/cms/servlet/key')
6 files changed, 14 insertions, 308 deletions
diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java b/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java index 2dffac22e..e64bcb2dc 100644 --- a/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java +++ b/base/common/src/com/netscape/cms/servlet/key/KeyRequestDAO.java @@ -32,19 +32,20 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.keydb.IKeyRecord; import com.netscape.certsrv.dbs.keydb.IKeyRepository; import com.netscape.certsrv.dbs.keydb.KeyId; +import com.netscape.certsrv.key.KeyArchivalRequest; +import com.netscape.certsrv.key.KeyRecoveryRequest; +import com.netscape.certsrv.key.KeyRequestInfo; +import com.netscape.certsrv.key.KeyRequestInfos; +import com.netscape.certsrv.key.KeyRequestResource; +import com.netscape.certsrv.key.KeyResource; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; import com.netscape.certsrv.profile.IEnrollProfile; +import com.netscape.certsrv.request.CMSRequestInfo; +import com.netscape.certsrv.request.CMSRequestInfos; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.servlet.request.CMSRequestDAO; -import com.netscape.cms.servlet.request.KeyRequestResource; -import com.netscape.cms.servlet.request.model.CMSRequestInfo; -import com.netscape.cms.servlet.request.model.CMSRequestInfos; -import com.netscape.cms.servlet.request.model.KeyArchivalRequest; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; -import com.netscape.cms.servlet.request.model.KeyRequestInfo; -import com.netscape.cms.servlet.request.model.KeyRequestInfos; /** * @author alee diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyResource.java b/base/common/src/com/netscape/cms/servlet/key/KeyResource.java deleted file mode 100644 index 948f2ff99..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/KeyResource.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.netscape.cms.servlet.key; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; - -import com.netscape.cms.servlet.key.model.KeyData; -import com.netscape.cms.servlet.key.model.KeyDataInfos; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; - -@Path("agent/keys") -public interface KeyResource { - - public static final int DEFAULT_MAXTIME = 10; - public static final int DEFAULT_MAXRESULTS = 100; - - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyDataInfos listKeys(@QueryParam("clientID") String clientID, - @QueryParam("status") String status, - @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults, - @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime); - - - /** - * Used to retrieve a key - * @param data - * @return - */ - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyData retrieveKey(KeyRecoveryRequest data); - - // retrieval - used to test integration with a browser - @POST - @Path("retrieve") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) - public KeyData retrieveKey(MultivaluedMap<String, String> form); -} diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyService.java b/base/common/src/com/netscape/cms/servlet/key/KeyService.java index 965723113..4db2fed0a 100644 --- a/base/common/src/com/netscape/cms/servlet/key/KeyService.java +++ b/base/common/src/com/netscape/cms/servlet/key/KeyService.java @@ -36,17 +36,18 @@ import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.dbs.keydb.IKeyRecord; import com.netscape.certsrv.dbs.keydb.IKeyRepository; import com.netscape.certsrv.dbs.keydb.KeyId; +import com.netscape.certsrv.key.KeyData; +import com.netscape.certsrv.key.KeyDataInfo; +import com.netscape.certsrv.key.KeyDataInfos; +import com.netscape.certsrv.key.KeyRecoveryRequest; +import com.netscape.certsrv.key.KeyRequestInfo; +import com.netscape.certsrv.key.KeyResource; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; import com.netscape.certsrv.request.IRequest; import com.netscape.certsrv.request.IRequestQueue; import com.netscape.certsrv.request.RequestId; import com.netscape.certsrv.request.RequestStatus; import com.netscape.cms.servlet.base.PKIService; -import com.netscape.cms.servlet.key.model.KeyData; -import com.netscape.cms.servlet.key.model.KeyDataInfo; -import com.netscape.cms.servlet.key.model.KeyDataInfos; -import com.netscape.cms.servlet.request.model.KeyRequestInfo; -import com.netscape.cms.servlet.request.model.KeyRecoveryRequest; import com.netscape.cmsutil.ldap.LDAPUtil; /** diff --git a/base/common/src/com/netscape/cms/servlet/key/model/KeyData.java b/base/common/src/com/netscape/cms/servlet/key/model/KeyData.java deleted file mode 100644 index 2ff2b5d0c..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/model/KeyData.java +++ /dev/null @@ -1,76 +0,0 @@ -// --- 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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- - -/** - * - */ -package com.netscape.cms.servlet.key.model; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; - -/** - * @author alee - * - */ -@XmlRootElement(name="SecurityData") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyData { - @XmlElement - String wrappedPrivateData; - - @XmlElement - String nonceData; - - public KeyData() { - // required for JAXB (defaults) - } - - /** - * @return the wrappedPrivateData - */ - public String getWrappedPrivateData() { - return wrappedPrivateData; - } - - /** - * @param wrappedPrivateData the wrappedPrivateData to set - */ - public void setWrappedPrivateData(String wrappedPrivateData) { - this.wrappedPrivateData = wrappedPrivateData; - } - - /** - * @return the nonceData - */ - - public String getNonceData() { - return nonceData; - } - - /** - * @param nonceData the nonceData to set - */ - - public void setNonceData(String nonceData) { - this.nonceData = nonceData; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfo.java b/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfo.java deleted file mode 100644 index 6fd9649fb..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfo.java +++ /dev/null @@ -1,85 +0,0 @@ -// --- 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) 2011 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -/** - * - */ -package com.netscape.cms.servlet.key.model; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessorType; - -import com.netscape.certsrv.dbs.keydb.KeyId; - -/** - * @author alee - * - */ -@XmlRootElement(name="SecurityDataInfo") -@XmlAccessorType(XmlAccessType.FIELD) -public class KeyDataInfo { - - @XmlElement - protected String keyURL; - - @XmlElement - protected String clientID; - - public KeyDataInfo() { - // required for JAXB (defaults) - } - - /** - * @return the keyURL - */ - public String getKeyURL() { - return keyURL; - } - - /** - * @param keyURL the keyURL to set - */ - public void setKeyURL(String keyURL) { - this.keyURL = keyURL; - } - - /** - * @return the key ID in the keyURL - */ - public KeyId getKeyId() { - String id = keyURL.substring(keyURL.lastIndexOf("/") + 1); - return new KeyId(id); - } - - /** - * @return the clientID - */ - public String getClientID() { - return clientID; - } - - /** - * @param clientID the clientID to set - */ - public void setClientID(String clientID) { - this.clientID = clientID; - } - -} diff --git a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfos.java b/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfos.java deleted file mode 100644 index 79e5add95..000000000 --- a/base/common/src/com/netscape/cms/servlet/key/model/KeyDataInfos.java +++ /dev/null @@ -1,87 +0,0 @@ -// --- 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) 2012 Red Hat, Inc. -// All rights reserved. -// --- END COPYRIGHT BLOCK --- -package com.netscape.cms.servlet.key.model; - -import java.util.Collection; -import java.util.List; - -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; - -import com.netscape.cms.servlet.base.model.Link; - -@XmlRootElement(name = "SecurityDataInfos") -public class KeyDataInfos { - - protected Collection<KeyDataInfo> keyInfos; - protected List<Link> links; - - /** - * @return the keyInfos - */ - @XmlElementRef - public Collection<KeyDataInfo> getKeyInfos() { - return keyInfos; - } - /** - * @param keyInfos the keyInfos to set - */ - public void setKeyInfos(Collection<KeyDataInfo> keyInfos) { - this.keyInfos = keyInfos; - } - /** - * @return the links - */ - @XmlElementRef - public List<Link> getLinks() { - return links; - } - /** - * @param links the links to set - */ - public void setLinks(List<Link> links) { - this.links = links; - } - - @XmlTransient - public String getNext() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("next".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } - - @XmlTransient - public String getPrevious() { - if (links == null) { - return null; - } - for (Link link : links) { - if ("previous".equals(link.getRelationship())) { - return link.getHref(); - } - } - return null; - } -} |