summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/tps
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2013-09-24 10:08:48 -0400
committerEndi S. Dewata <edewata@redhat.com>2013-10-01 19:25:39 -0400
commite339952dfad45bc0ba1768a9386817eadd49b9dc (patch)
tree9654dfcee299337c23d3536e913478f8c3dabcaa /base/common/src/com/netscape/certsrv/tps
parenta3ac3ef0ca5e720a4cd5b17e9181124c17d17ea7 (diff)
downloadpki-e339952dfad45bc0ba1768a9386817eadd49b9dc.tar.gz
pki-e339952dfad45bc0ba1768a9386817eadd49b9dc.tar.xz
pki-e339952dfad45bc0ba1768a9386817eadd49b9dc.zip
Refactored TPS configuration resource.
The REST interface for TPS configuration has been modified to provide access to TPS general configuration as originally designed. The configuration database has been modified such that it can be reused by other configuration resources. Ticket #652
Diffstat (limited to 'base/common/src/com/netscape/certsrv/tps')
-rw-r--r--base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java12
-rw-r--r--base/common/src/com/netscape/certsrv/tps/config/ConfigData.java44
-rw-r--r--base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java13
3 files changed, 21 insertions, 48 deletions
diff --git a/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java b/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java
index c3876bf83..9c707e494 100644
--- a/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java
+++ b/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java
@@ -44,17 +44,13 @@ public class ConfigClient extends Client {
resource = createProxy(ConfigResource.class);
}
- public ConfigCollection findConfigs() {
- return resource.findConfigs();
+ public ConfigData getConfig() {
+ return resource.getConfig();
}
- public ConfigData getConfig(String configID) {
- return resource.getConfig(configID);
- }
-
- public ConfigData updateConfig(String configID, ConfigData configData) {
+ public ConfigData updateConfig(ConfigData configData) {
@SuppressWarnings("unchecked")
- ClientResponse<ConfigData> response = (ClientResponse<ConfigData>)resource.updateConfig(configID, configData);
+ ClientResponse<ConfigData> response = (ClientResponse<ConfigData>)resource.updateConfig(configData);
return client.getEntity(response);
}
}
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 1b3688f5e..2a36f3fa8 100644
--- a/base/common/src/com/netscape/certsrv/tps/config/ConfigData.java
+++ b/base/common/src/com/netscape/certsrv/tps/config/ConfigData.java
@@ -57,27 +57,18 @@ public class ConfigData {
}
}
- String id;
- String displayName;
+ String status;
Map<String, String> properties = new LinkedHashMap<String, String>();
- Link link;
-
- @XmlAttribute(name="id")
- public String getID() {
- return id;
- }
- public void setID(String id) {
- this.id = id;
- }
+ Link link;
- @XmlElement(name="DisplayName")
- public String getDisplayName() {
- return displayName;
+ @XmlElement(name="Status")
+ public String getStatus() {
+ return status;
}
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
+ public void setStatus(String status) {
+ this.status = status;
}
@XmlElement(name="Properties")
@@ -156,10 +147,9 @@ public class ConfigData {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
- result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((link == null) ? 0 : link.hashCode());
result = prime * result + ((properties == null) ? 0 : properties.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
return result;
}
@@ -172,16 +162,6 @@ public class ConfigData {
if (getClass() != obj.getClass())
return false;
ConfigData other = (ConfigData) obj;
- if (displayName == null) {
- if (other.displayName != null)
- return false;
- } else if (!displayName.equals(other.displayName))
- return false;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
if (link == null) {
if (other.link != null)
return false;
@@ -192,6 +172,11 @@ public class ConfigData {
return false;
} else if (!properties.equals(other.properties))
return false;
+ if (status == null) {
+ if (other.status != null)
+ return false;
+ } else if (!status.equals(other.status))
+ return false;
return true;
}
@@ -217,8 +202,7 @@ public class ConfigData {
public static void main(String args[]) throws Exception {
ConfigData before = new ConfigData();
- before.setID("test");
- before.setDisplayName("Test Config");
+ before.setStatus("ENABLED");
before.setProperty("param1", "value1");
before.setProperty("param2", "value2");
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 a15730a4b..e1076a48e 100644
--- a/base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java
+++ b/base/common/src/com/netscape/certsrv/tps/config/ConfigResource.java
@@ -21,7 +21,6 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -32,22 +31,16 @@ import org.jboss.resteasy.annotations.ClientResponseType;
/**
* @author Endi S. Dewata
*/
-@Path("configs")
+@Path("config")
public interface ConfigResource {
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public ConfigCollection findConfigs();
-
- @GET
- @Path("{configID}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public ConfigData getConfig(@PathParam("configID") String configID);
+ public ConfigData getConfig();
@PUT
- @Path("{configID}")
@ClientResponseType(entityType=ConfigData.class)
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response updateConfig(@PathParam("configID") String configID, ConfigData configData);
+ public Response updateConfig(ConfigData configData);
}