summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/tps
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2014-04-04 11:52:37 -0400
committerEndi S. Dewata <edewata@redhat.com>2014-04-08 16:07:18 -0400
commitd79e4f9500bbdd758d2c33128a2d58a3d3602fa7 (patch)
tree6d888e0a3a36df9a9417ed9ef6fcbc3638dd16d8 /base/common/src/com/netscape/certsrv/tps
parentc289405e411c5731fa21e31b5121ee4c2739258c (diff)
downloadpki-d79e4f9500bbdd758d2c33128a2d58a3d3602fa7.tar.gz
pki-d79e4f9500bbdd758d2c33128a2d58a3d3602fa7.tar.xz
pki-d79e4f9500bbdd758d2c33128a2d58a3d3602fa7.zip
Added general configuration page.
A new page has been added to manage general TPS configuration properties. The properties are read-only by default. In edit mode the property name will become a link which will show a dialog to edit the property value. The config REST service has been updated to use PATCH for update operation and handle possible null collection of properties. Fixed a bug in TableItem.reset() where the code didn't clear the table cell properly. Fixed a bug in ConfigDatabase.getProperties() where the code didn't handle null property key properly. Ticket #654
Diffstat (limited to 'base/common/src/com/netscape/certsrv/tps')
-rw-r--r--base/common/src/com/netscape/certsrv/tps/config/ConfigData.java33
-rw-r--r--base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java4
2 files changed, 13 insertions, 24 deletions
diff --git a/base/common/src/com/netscape/certsrv/tps/config/ConfigData.java b/base/common/src/com/netscape/certsrv/tps/config/ConfigData.java
index 2a36f3fa8..7bfb86ea8 100644
--- a/base/common/src/com/netscape/certsrv/tps/config/ConfigData.java
+++ b/base/common/src/com/netscape/certsrv/tps/config/ConfigData.java
@@ -21,14 +21,16 @@ package com.netscape.certsrv.tps.config;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -42,6 +44,7 @@ import org.jboss.resteasy.plugins.providers.atom.Link;
* @author Endi S. Dewata
*/
@XmlRootElement(name="Configuration")
+@XmlAccessorType(XmlAccessType.NONE)
public class ConfigData {
public static Marshaller marshaller;
@@ -58,7 +61,7 @@ public class ConfigData {
}
String status;
- Map<String, String> properties = new LinkedHashMap<String, String>();
+ Map<String, String> properties;
Link link;
@@ -78,24 +81,7 @@ public class ConfigData {
}
public void setProperties(Map<String, String> properties) {
- this.properties.clear();
- this.properties.putAll(properties);
- }
-
- public Collection<String> getPropertyNames() {
- return properties.keySet();
- }
-
- public String getProperty(String name) {
- return properties.get(name);
- }
-
- public void setProperty(String name, String value) {
- properties.put(name, value);
- }
-
- public String removeProperty(String name) {
- return properties.remove(name);
+ this.properties = properties;
}
public static class MapAdapter extends XmlAdapter<PropertyList, Map<String, String>> {
@@ -203,8 +189,11 @@ public class ConfigData {
ConfigData before = new ConfigData();
before.setStatus("ENABLED");
- before.setProperty("param1", "value1");
- before.setProperty("param2", "value2");
+
+ Map<String, String> properties = new TreeMap<String, String>();
+ properties.put("param1", "value1");
+ properties.put("param2", "value2");
+ before.setProperties(properties);
String string = before.toString();
System.out.println(string);
diff --git a/base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java b/base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java
index a7f33fada..1461b06c0 100644
--- a/base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java
+++ b/base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java
@@ -18,7 +18,6 @@
package com.netscape.certsrv.tps.config;
import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@@ -26,6 +25,7 @@ import org.jboss.resteasy.annotations.ClientResponseType;
import com.netscape.certsrv.acls.ACLMapping;
import com.netscape.certsrv.authentication.AuthMethodMapping;
+import com.netscape.certsrv.base.PATCH;
/**
@@ -40,7 +40,7 @@ public interface ConfigResource {
@ClientResponseType(entityType=ConfigData.class)
public Response getConfig();
- @PUT
+ @PATCH
@ClientResponseType(entityType=ConfigData.class)
@ACLMapping("config.modify")
public Response updateConfig(ConfigData configData);