diff options
author | Ade Lee <alee@redhat.com> | 2014-02-03 13:19:46 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2014-02-04 13:37:57 -0500 |
commit | cf425dfa25bccb467c63b9a966adf3a7eec791df (patch) | |
tree | 469ec668473730d9dc23e327ce444ee61373e702 /base/common | |
parent | d33998c72a34dc9f04e29ce0248fc2b7b88e0fc5 (diff) | |
download | pki-cf425dfa25bccb467c63b9a966adf3a7eec791df.tar.gz pki-cf425dfa25bccb467c63b9a966adf3a7eec791df.tar.xz pki-cf425dfa25bccb467c63b9a966adf3a7eec791df.zip |
Address review comments
1. Remove Link attribute from ResourceMessage,
2. Rename KeyDataInfo and KeyDataInfoCollection.
3. Move KEYGEN_ALGORITHMS
4. Fix missing space in PKIException
5. Move properties to attributes in ResourceMessage
6. Add missing code to update the request and set IRequest.RESULT
Diffstat (limited to 'base/common')
15 files changed, 117 insertions, 141 deletions
diff --git a/base/common/src/com/netscape/certsrv/base/PKIException.java b/base/common/src/com/netscape/certsrv/base/PKIException.java index 65ff6db8e..f1f377352 100644 --- a/base/common/src/com/netscape/certsrv/base/PKIException.java +++ b/base/common/src/com/netscape/certsrv/base/PKIException.java @@ -84,7 +84,7 @@ public class PKIException extends RuntimeException { } @XmlRootElement(name="PKIException") - public static class Data extends ResourceMessage{ + public static class Data extends ResourceMessage { @XmlElement(name="Code") public int code; @@ -111,8 +111,8 @@ public class PKIException extends RuntimeException { data.className = PKIException.class.getName(); data.code = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(); data.message = "An error has occured"; - data.setProperty("attr1", "value1"); - data.setProperty("attr2", "value2"); + data.setAttribute("attr1", "value1"); + data.setAttribute("attr2", "value2"); JAXBContext context = JAXBContext.newInstance(Data.class); Marshaller marshaller = context.createMarshaller(); diff --git a/base/common/src/com/netscape/certsrv/base/ResourceMessage.java b/base/common/src/com/netscape/certsrv/base/ResourceMessage.java index dd2f48078..57b5539b8 100644 --- a/base/common/src/com/netscape/certsrv/base/ResourceMessage.java +++ b/base/common/src/com/netscape/certsrv/base/ResourceMessage.java @@ -20,16 +20,13 @@ import javax.xml.bind.annotation.XmlValue; import javax.xml.bind.annotation.adapters.XmlAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import org.jboss.resteasy.plugins.providers.atom.Link; - /** * @author Ade Lee */ @XmlRootElement(name="ResourceMessage") public class ResourceMessage { - protected Map<String, String> properties = new LinkedHashMap<String, String>(); - Link link; + protected Map<String, String> attributes = new LinkedHashMap<String, String>(); String className; public ResourceMessage() { @@ -38,7 +35,7 @@ public class ResourceMessage { public ResourceMessage(MultivaluedMap<String, String> form) { for (Map.Entry<String, List<String>> entry: form.entrySet()) { - properties.put(entry.getKey(), entry.getValue().get(0)); + attributes.put(entry.getKey(), entry.getValue().get(0)); } } @@ -51,61 +48,61 @@ public class ResourceMessage { this.className = className; } - @XmlElement(name = "Properties") + @XmlElement(name = "Attributes") @XmlJavaTypeAdapter(MapAdapter.class) - public Map<String, String> getProperties() { - return properties; + public Map<String, String> getAttributes() { + return attributes; } - public void setProperties(Map<String, String> properties) { - this.properties.clear(); - this.properties.putAll(properties); + public void setAttributes(Map<String, String> attributes) { + this.attributes.clear(); + this.attributes.putAll(attributes); } - public Collection<String> getPropertyNames() { - return properties.keySet(); + public Collection<String> getAttributeNames() { + return attributes.keySet(); } - public String getProperty(String name) { - return properties.get(name); + public String getAttribute(String name) { + return attributes.get(name); } - public void setProperty(String name, String value) { - properties.put(name, value); + public void setAttribute(String name, String value) { + attributes.put(name, value); } - public String removeProperty(String name) { - return properties.remove(name); + public String removeAttribute(String name) { + return attributes.remove(name); } - public static class MapAdapter extends XmlAdapter<PropertyList, Map<String, String>> { + public static class MapAdapter extends XmlAdapter<AttributeList, Map<String, String>> { - public PropertyList marshal(Map<String, String> map) { - PropertyList list = new PropertyList(); + public AttributeList marshal(Map<String, String> map) { + AttributeList list = new AttributeList(); for (Map.Entry<String, String> entry : map.entrySet()) { - Property property = new Property(); - property.name = entry.getKey(); - property.value = entry.getValue(); - list.properties.add(property); + Attribute attribute = new Attribute(); + attribute.name = entry.getKey(); + attribute.value = entry.getValue(); + list.attrs.add(attribute); } return list; } - public Map<String, String> unmarshal(PropertyList list) { + public Map<String, String> unmarshal(AttributeList list) { Map<String, String> map = new LinkedHashMap<String, String>(); - for (Property property : list.properties) { - map.put(property.name, property.value); + for (Attribute attribute : list.attrs) { + map.put(attribute.name, attribute.value); } return map; } } - public static class PropertyList { - @XmlElement(name = "Property") - public List<Property> properties = new ArrayList<Property>(); + public static class AttributeList { + @XmlElement(name = "Attribute") + public List<Attribute> attrs = new ArrayList<Attribute>(); } - public static class Property { + public static class Attribute { @XmlAttribute public String name; @@ -114,21 +111,11 @@ public class ResourceMessage { public String value; } - @XmlElement(name = "Link") - public Link getLink() { - return link; - } - - public void setLink(Link link) { - this.link = link; - } - @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((link == null) ? 0 : link.hashCode()); - result = prime * result + ((properties == null) ? 0 : properties.hashCode()); + result = prime * result + ((attributes == null) ? 0 : attributes.hashCode()); result = prime * result + ((className == null) ? 0 : className.hashCode()); return result; } @@ -142,15 +129,10 @@ public class ResourceMessage { if (getClass() != obj.getClass()) return false; ResourceMessage other = (ResourceMessage) obj; - if (link == null) { - if (other.link != null) - return false; - } else if (!link.equals(other.link)) - return false; - if (properties == null) { - if (other.properties != null) + if (attributes == null) { + if (other.attributes != null) return false; - } else if (!properties.equals(other.properties)) + } else if (!attributes.equals(other.attributes)) return false; if (className == null) { if (other.className != null) diff --git a/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java b/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java index ec14b59aa..63df7067a 100644 --- a/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java +++ b/base/common/src/com/netscape/certsrv/base/UserNotFoundException.java @@ -21,12 +21,12 @@ public class UserNotFoundException extends ResourceNotFoundException { public UserNotFoundException(Data data) { super(data); - userId = data.getProperty("userId"); + userId = data.getAttribute("userId"); } public Data getData() { Data data = super.getData(); - data.setProperty("userId", userId); + data.setAttribute("userId", userId); return data; } diff --git a/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java b/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java index 5b694ad15..171c2763d 100644 --- a/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java +++ b/base/common/src/com/netscape/certsrv/cert/CertNotFoundException.java @@ -42,12 +42,12 @@ public class CertNotFoundException extends ResourceNotFoundException { public CertNotFoundException(Data data) { super(data); - certId = new CertId(data.getProperty("certId")); + certId = new CertId(data.getAttribute("certId")); } public Data getData() { Data data = super.getData(); - data.setProperty("certId", certId.toString()); + data.setAttribute("certId", certId.toString()); return data; } diff --git a/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java b/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java index c5167db8f..3bd9241b6 100644 --- a/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java +++ b/base/common/src/com/netscape/certsrv/group/GroupNotFoundException.java @@ -23,12 +23,12 @@ public class GroupNotFoundException extends ResourceNotFoundException { public GroupNotFoundException(Data data) { super(data); - groupId = data.getProperty("groupId"); + groupId = data.getAttribute("groupId"); } public Data getData() { Data data = super.getData(); - data.setProperty("groupId", groupId); + data.setAttribute("groupId", groupId); return data; } diff --git a/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java b/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java index c72bad4b9..1655fdb28 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java +++ b/base/common/src/com/netscape/certsrv/key/KeyArchivalRequest.java @@ -46,14 +46,14 @@ public class KeyArchivalRequest extends ResourceMessage { } public KeyArchivalRequest(MultivaluedMap<String, String> form) { - properties.put(CLIENT_ID, form.getFirst(CLIENT_ID)); - properties.put(DATA_TYPE, form.getFirst(DATA_TYPE)); - properties.put(WRAPPED_PRIVATE_DATA, form.getFirst(WRAPPED_PRIVATE_DATA)); + attributes.put(CLIENT_ID, form.getFirst(CLIENT_ID)); + attributes.put(DATA_TYPE, form.getFirst(DATA_TYPE)); + attributes.put(WRAPPED_PRIVATE_DATA, form.getFirst(WRAPPED_PRIVATE_DATA)); setClassName(getClass().getName()); } public KeyArchivalRequest(ResourceMessage data) { - properties.putAll(data.getProperties()); + attributes.putAll(data.getAttributes()); setClassName(getClass().getName()); } @@ -61,42 +61,42 @@ public class KeyArchivalRequest extends ResourceMessage { * @return the clientId */ public String getClientId() { - return properties.get(CLIENT_ID); + return attributes.get(CLIENT_ID); } /** * @param clientId the clientId to set */ public void setClientId(String clientId) { - properties.put(CLIENT_ID, clientId); + attributes.put(CLIENT_ID, clientId); } /** * @return the dataType */ public String getDataType() { - return properties.get(DATA_TYPE); + return attributes.get(DATA_TYPE); } /** * @param dataType the dataType to set */ public void setDataType(String dataType) { - properties.put(DATA_TYPE, dataType); + attributes.put(DATA_TYPE, dataType); } /** * @return the wrappedPrivateData */ public String getWrappedPrivateData() { - return properties.get(WRAPPED_PRIVATE_DATA); + return attributes.get(WRAPPED_PRIVATE_DATA); } /** * @param wrappedPrivateData the wrappedPrivateData to set */ public void setWrappedPrivateData(String wrappedPrivateData) { - properties.put(WRAPPED_PRIVATE_DATA, wrappedPrivateData); + attributes.put(WRAPPED_PRIVATE_DATA, wrappedPrivateData); } public String toString() { diff --git a/base/common/src/com/netscape/certsrv/key/KeyClient.java b/base/common/src/com/netscape/certsrv/key/KeyClient.java index 06c7cfd79..280b10c49 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyClient.java +++ b/base/common/src/com/netscape/certsrv/key/KeyClient.java @@ -44,7 +44,7 @@ public class KeyClient extends Client { keyRequestClient = createProxy(KeyRequestResource.class); } - public KeyDataInfoCollection findKeys(String clientID, String status, Integer maxSize, Integer maxTime, + public KeyInfoCollection findKeys(String clientID, String status, Integer maxSize, Integer maxTime, Integer start, Integer size) { return keyClient.listKeys(clientID, status, maxSize, maxTime, start, size); } diff --git a/base/common/src/com/netscape/certsrv/key/KeyDataInfo.java b/base/common/src/com/netscape/certsrv/key/KeyInfo.java index 09d228718..a4f4e62f3 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyDataInfo.java +++ b/base/common/src/com/netscape/certsrv/key/KeyInfo.java @@ -32,9 +32,9 @@ import com.netscape.certsrv.dbs.keydb.KeyId; * @author alee * */ -@XmlRootElement(name="KeyDataInfo") +@XmlRootElement(name="KeyInfo") @XmlAccessorType(XmlAccessType.FIELD) -public class KeyDataInfo { +public class KeyInfo { @XmlElement protected String keyURL; @@ -54,7 +54,7 @@ public class KeyDataInfo { @XmlElement protected String ownerName; - public KeyDataInfo() { + public KeyInfo() { // required for JAXB (defaults) } diff --git a/base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java b/base/common/src/com/netscape/certsrv/key/KeyInfoCollection.java index 4e67e2a44..3d411da69 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyDataInfoCollection.java +++ b/base/common/src/com/netscape/certsrv/key/KeyInfoCollection.java @@ -24,11 +24,11 @@ import javax.xml.bind.annotation.XmlRootElement; import com.netscape.certsrv.base.DataCollection; -@XmlRootElement(name = "KeyDataInfos") -public class KeyDataInfoCollection extends DataCollection<KeyDataInfo> { +@XmlRootElement(name = "KeyInfoCollection") +public class KeyInfoCollection extends DataCollection<KeyInfo> { @XmlElementRef - public Collection<KeyDataInfo> getEntries() { + public Collection<KeyInfo> getEntries() { return super.getEntries(); } } diff --git a/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java index 4b521a57c..e12b414b1 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java +++ b/base/common/src/com/netscape/certsrv/key/KeyRecoveryRequest.java @@ -53,21 +53,21 @@ public class KeyRecoveryRequest extends ResourceMessage { public KeyRecoveryRequest(MultivaluedMap<String, String> form) { if (form.containsKey(KEY_ID)) { - properties.put(KEY_ID, form.getFirst(KEY_ID)); + attributes.put(KEY_ID, form.getFirst(KEY_ID)); } if (form.containsKey(REQUEST_ID)) { - properties.put(REQUEST_ID, form.getFirst(REQUEST_ID)); + attributes.put(REQUEST_ID, form.getFirst(REQUEST_ID)); } - properties.put(TRANS_WRAPPED_SESSION_KEY, form.getFirst(TRANS_WRAPPED_SESSION_KEY)); - properties.put(SESSION_WRAPPED_PASSPHRASE, form.getFirst(SESSION_WRAPPED_PASSPHRASE)); - properties.put(NONCE_DATA, form.getFirst(NONCE_DATA)); - properties.put(CERTIFICATE, form.getFirst(CERTIFICATE)); - properties.put(PASSPHRASE, form.getFirst(PASSPHRASE)); + attributes.put(TRANS_WRAPPED_SESSION_KEY, form.getFirst(TRANS_WRAPPED_SESSION_KEY)); + attributes.put(SESSION_WRAPPED_PASSPHRASE, form.getFirst(SESSION_WRAPPED_PASSPHRASE)); + attributes.put(NONCE_DATA, form.getFirst(NONCE_DATA)); + attributes.put(CERTIFICATE, form.getFirst(CERTIFICATE)); + attributes.put(PASSPHRASE, form.getFirst(PASSPHRASE)); setClassName(getClass().getName()); } public KeyRecoveryRequest(ResourceMessage data) { - properties.putAll(data.getProperties()); + attributes.putAll(data.getAttributes()); setClassName(getClass().getName()); } @@ -75,56 +75,56 @@ public class KeyRecoveryRequest extends ResourceMessage { * @return the keyId */ public KeyId getKeyId() { - return new KeyId(properties.get(KEY_ID)); + return new KeyId(attributes.get(KEY_ID)); } /** * @param keyId the keyId to set */ public void setKeyId(KeyId keyId) { - properties.put(KEY_ID, keyId.toString()); + attributes.put(KEY_ID, keyId.toString()); } /** * @return the requestId */ public RequestId getRequestId() { - return new RequestId(properties.get(REQUEST_ID)); + return new RequestId(attributes.get(REQUEST_ID)); } /** * @param requestId the requestId to set */ public void setRequestId(RequestId requestId) { - properties.put(REQUEST_ID, requestId.toString()); + attributes.put(REQUEST_ID, requestId.toString()); } /** * @return the transWrappedSessionKey */ public String getTransWrappedSessionKey() { - return properties.get(TRANS_WRAPPED_SESSION_KEY); + return attributes.get(TRANS_WRAPPED_SESSION_KEY); } /** * @param transWrappedSessionKey the transWrappedSessionKey to set */ public void setTransWrappedSessionKey(String transWrappedSessionKey) { - properties.put(TRANS_WRAPPED_SESSION_KEY, transWrappedSessionKey); + attributes.put(TRANS_WRAPPED_SESSION_KEY, transWrappedSessionKey); } /** * @return the sessionWrappedPassphrase */ public String getSessionWrappedPassphrase() { - return properties.get(SESSION_WRAPPED_PASSPHRASE); + return attributes.get(SESSION_WRAPPED_PASSPHRASE); } /** * @param sessionWrappedPassphrase the sessionWrappedPassphrase to set */ public void setSessionWrappedPassphrase(String sessionWrappedPassphrase) { - properties.put(SESSION_WRAPPED_PASSPHRASE, sessionWrappedPassphrase); + attributes.put(SESSION_WRAPPED_PASSPHRASE, sessionWrappedPassphrase); } /** @@ -132,7 +132,7 @@ public class KeyRecoveryRequest extends ResourceMessage { */ public String getNonceData() { - return properties.get(NONCE_DATA); + return attributes.get(NONCE_DATA); } /** @@ -140,35 +140,35 @@ public class KeyRecoveryRequest extends ResourceMessage { */ public void setNonceData(String nonceData) { - properties.put(NONCE_DATA, nonceData); + attributes.put(NONCE_DATA, nonceData); } /** * @return the certificate */ public String getCertificate() { - return properties.get(CERTIFICATE); + return attributes.get(CERTIFICATE); } /** * @param certificate the certificate to set */ public void setCertificate(String certificate) { - properties.put(CERTIFICATE, certificate); + attributes.put(CERTIFICATE, certificate); } /** * @return the passphrase */ public String getPassphrase() { - return properties.get(PASSPHRASE); + return attributes.get(PASSPHRASE); } /** * @param passphrase the passphrase to set */ public void setPassphrase(String passphrase) { - properties.put(PASSPHRASE, passphrase); + attributes.put(PASSPHRASE, passphrase); } diff --git a/base/common/src/com/netscape/certsrv/key/KeyResource.java b/base/common/src/com/netscape/certsrv/key/KeyResource.java index 68efb7770..04d57fd2b 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyResource.java +++ b/base/common/src/com/netscape/certsrv/key/KeyResource.java @@ -20,7 +20,7 @@ public interface KeyResource { @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyDataInfoCollection listKeys(@QueryParam("clientID") String clientID, + public KeyInfoCollection listKeys(@QueryParam("clientID") String clientID, @QueryParam("status") String status, @QueryParam("maxResults") Integer maxResults, @QueryParam("maxTime") Integer maxTime, diff --git a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java index 88f3e2381..f9feb6410 100644 --- a/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java +++ b/base/common/src/com/netscape/certsrv/key/SymKeyGenerationRequest.java @@ -2,9 +2,7 @@ package com.netscape.certsrv.key; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.ws.rs.core.MultivaluedMap; import javax.xml.bind.annotation.XmlAccessType; @@ -12,7 +10,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.lang.StringUtils; -import org.mozilla.jss.crypto.KeyGenAlgorithm; import com.netscape.certsrv.base.ResourceMessage; @@ -29,6 +26,14 @@ public class SymKeyGenerationRequest extends ResourceMessage { private static final String KEY_ALGORITHM = "keyAlgorithm"; private static final String KEY_USAGE = "keyUsage"; + /* Symmetric Key Algorithms */ + public static final String DES_ALGORITHM = "DES"; + public static final String DESEDE_ALGORITHM = "DESede"; + public static final String DES3_ALGORITHM = "DES3"; + public static final String RC2_ALGORITHM = "RC2"; + public static final String RC4_ALGORITHM = "RC4"; + public static final String AES_ALGORITHM = "AES"; + /* Symmetric Key usages */ public static final String UWRAP_USAGE = "unwrap"; public static final String WRAP_USAGE = "wrap"; @@ -37,19 +42,8 @@ public class SymKeyGenerationRequest extends ResourceMessage { public static final String DECRYPT_USAGE = "decrypt"; public static final String ENCRYPT_USAGE = "encrypt"; - public static final Map<String, KeyGenAlgorithm> KEYGEN_ALGORITHMS; - static { - KEYGEN_ALGORITHMS = new HashMap<String, KeyGenAlgorithm>(); - KEYGEN_ALGORITHMS.put("DES", KeyGenAlgorithm.DES); - KEYGEN_ALGORITHMS.put("DESede", KeyGenAlgorithm.DESede); - KEYGEN_ALGORITHMS.put("DES3", KeyGenAlgorithm.DES3); - KEYGEN_ALGORITHMS.put("RC2", KeyGenAlgorithm.RC2); - KEYGEN_ALGORITHMS.put("RC4", KeyGenAlgorithm.RC4); - KEYGEN_ALGORITHMS.put("AES", KeyGenAlgorithm.AES); - } - public List<String> getUsages() { - String usageString = properties.get(KEY_USAGE); + String usageString = attributes.get(KEY_USAGE); if (! StringUtils.isBlank(usageString)) { return new ArrayList<String>(Arrays.asList(usageString.split(","))); } @@ -57,7 +51,7 @@ public class SymKeyGenerationRequest extends ResourceMessage { } public void setUsages(List<String> usages) { - properties.put(KEY_USAGE, StringUtils.join(usages, ",")); + attributes.put(KEY_USAGE, StringUtils.join(usages, ",")); } public void addUsage(String usage) { @@ -75,12 +69,12 @@ public class SymKeyGenerationRequest extends ResourceMessage { } public SymKeyGenerationRequest(MultivaluedMap<String, String> form) { - properties.put(CLIENT_ID, form.getFirst(CLIENT_ID)); - properties.put(KEY_SIZE, form.getFirst(KEY_SIZE)); - properties.put(KEY_ALGORITHM, form.getFirst(KEY_ALGORITHM)); - properties.put(KEY_USAGE, form.getFirst(KEY_USAGE)); + attributes.put(CLIENT_ID, form.getFirst(CLIENT_ID)); + attributes.put(KEY_SIZE, form.getFirst(KEY_SIZE)); + attributes.put(KEY_ALGORITHM, form.getFirst(KEY_ALGORITHM)); + attributes.put(KEY_USAGE, form.getFirst(KEY_USAGE)); - String usageString = properties.get(KEY_USAGE); + String usageString = attributes.get(KEY_USAGE); if (! StringUtils.isBlank(usageString)) { setUsages(new ArrayList<String>(Arrays.asList(usageString.split(",")))); } @@ -88,7 +82,7 @@ public class SymKeyGenerationRequest extends ResourceMessage { } public SymKeyGenerationRequest(ResourceMessage data) { - properties.putAll(data.getProperties()); + attributes.putAll(data.getAttributes()); setClassName(getClass().getName()); } @@ -96,42 +90,42 @@ public class SymKeyGenerationRequest extends ResourceMessage { * @return the clientId */ public String getClientId() { - return properties.get(CLIENT_ID); + return attributes.get(CLIENT_ID); } /** * @param clientId the clientId to set */ public void setClientId(String clientId) { - properties.put(CLIENT_ID, clientId); + attributes.put(CLIENT_ID, clientId); } /** * @return the keySize */ public int getKeySize() { - return Integer.parseInt(properties.get(KEY_SIZE)); + return Integer.parseInt(attributes.get(KEY_SIZE)); } /** * @param keySize the key size to set */ public void setKeySize(int keySize) { - properties.put(KEY_SIZE, Integer.toString(keySize)); + attributes.put(KEY_SIZE, Integer.toString(keySize)); } /** * @return the keyAlgorithm */ public String getKeyAlgorithm() { - return properties.get(KEY_ALGORITHM); + return attributes.get(KEY_ALGORITHM); } /** * @param keyAlgorithm the key algorithm to set */ public void setKeyAlgorithm(String keyAlgorithm) { - properties.put(KEY_ALGORITHM, keyAlgorithm); + attributes.put(KEY_ALGORITHM, keyAlgorithm); } public String toString() { @@ -154,7 +148,7 @@ public class SymKeyGenerationRequest extends ResourceMessage { SymKeyGenerationRequest before = new SymKeyGenerationRequest(); before.setClientId("vek 12345"); - before.setKeyAlgorithm("AES"); + before.setKeyAlgorithm(SymKeyGenerationRequest.AES_ALGORITHM); before.setKeySize(128); before.addUsage(SymKeyGenerationRequest.DECRYPT_USAGE); before.addUsage(SymKeyGenerationRequest.ENCRYPT_USAGE); diff --git a/base/common/src/com/netscape/certsrv/kra/KRAClient.java b/base/common/src/com/netscape/certsrv/kra/KRAClient.java index 2522820f4..943a6f21f 100644 --- a/base/common/src/com/netscape/certsrv/kra/KRAClient.java +++ b/base/common/src/com/netscape/certsrv/kra/KRAClient.java @@ -14,8 +14,8 @@ import com.netscape.certsrv.dbs.keydb.KeyId; import com.netscape.certsrv.group.GroupClient; import com.netscape.certsrv.key.KeyArchivalRequest; import com.netscape.certsrv.key.KeyData; -import com.netscape.certsrv.key.KeyDataInfo; -import com.netscape.certsrv.key.KeyDataInfoCollection; +import com.netscape.certsrv.key.KeyInfo; +import com.netscape.certsrv.key.KeyInfoCollection; import com.netscape.certsrv.key.KeyRecoveryRequest; import com.netscape.certsrv.key.KeyRequestInfo; import com.netscape.certsrv.key.KeyRequestInfoCollection; @@ -83,13 +83,13 @@ public class KRAClient extends SubsystemClient { return client.getEntity(response); } - public KeyDataInfo getKeyData(String clientId, String status) { - KeyDataInfoCollection infos = keyClient.listKeys(clientId, status, null, null, null, null); - Collection<KeyDataInfo> list = infos.getEntries(); - Iterator<KeyDataInfo> iter = list.iterator(); + public KeyInfo getKeyData(String clientId, String status) { + KeyInfoCollection infos = keyClient.listKeys(clientId, status, null, null, null, null); + Collection<KeyInfo> list = infos.getEntries(); + Iterator<KeyInfo> iter = list.iterator(); while (iter.hasNext()) { - KeyDataInfo info = iter.next(); + KeyInfo info = iter.next(); if (info != null) { // return the first one return info; diff --git a/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java b/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java index 25c6d4bfd..c6a549b07 100644 --- a/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java +++ b/base/common/src/com/netscape/certsrv/profile/ProfileNotFoundException.java @@ -41,12 +41,12 @@ public class ProfileNotFoundException extends ResourceNotFoundException { public ProfileNotFoundException(Data data) { super(data); - profileId = data.getProperty("profileId"); + profileId = data.getAttribute("profileId"); } public Data getData() { Data data = super.getData(); - data.setProperty("profileId", profileId); + data.setAttribute("profileId", profileId); return data; } diff --git a/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java b/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java index d1032dc2b..478675ab0 100644 --- a/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java +++ b/base/common/src/com/netscape/certsrv/request/RequestNotFoundException.java @@ -24,12 +24,12 @@ public class RequestNotFoundException extends ResourceNotFoundException { public RequestNotFoundException(Data data) { super(data); - requestId = new RequestId(data.getProperty("requestId")); + requestId = new RequestId(data.getAttribute("requestId")); } public Data getData() { Data data = super.getData(); - data.setProperty("requestId", requestId.toString()); + data.setAttribute("requestId", requestId.toString()); return data; } |