From 0b779ffe4d29474b4f75370e4da9d7723d9bfec5 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Sat, 23 Apr 2016 00:50:08 +0200 Subject: Renamed token status TEMP_LOST to SUSPENDED. The token status TEMP_LOST has been renamed to SUSPENDED such that it can be used more general contexts. To simplify the transition, the CLIs and the REST API will continue to accept TEMP_LOST but it will be converted internally into SUSPENDED and a deprecation warning will be generated. https://fedorahosted.org/pki/ticket/2286 --- .../src/com/netscape/certsrv/tps/token/TokenStatus.java | 9 +++++++-- base/tps-client/doc/CS.cfg.in | 4 ++-- base/tps/shared/conf/CS.cfg.in | 4 ++-- base/tps/shared/conf/token-states.properties | 14 +++++++------- base/tps/shared/webapps/tps/js/token.js | 2 +- base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java | 4 ++-- base/tps/src/org/dogtagpki/server/tps/dbs/TokenRecord.java | 2 +- .../src/org/dogtagpki/server/tps/rest/TokenService.java | 4 ++-- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/base/common/src/com/netscape/certsrv/tps/token/TokenStatus.java b/base/common/src/com/netscape/certsrv/tps/token/TokenStatus.java index b2f23dd9c..f3dd73e38 100644 --- a/base/common/src/com/netscape/certsrv/tps/token/TokenStatus.java +++ b/base/common/src/com/netscape/certsrv/tps/token/TokenStatus.java @@ -51,7 +51,7 @@ public class TokenStatus { public final static int TOKEN_UNINITIALIZED = 0; public final static int TOKEN_DAMAGED = 1; public final static int TOKEN_PERM_LOST = 2; - public final static int TOKEN_TEMP_LOST = 3; + public final static int TOKEN_SUSPENDED = 3; public final static int TOKEN_ACTIVE = 4; public final static int TOKEN_TEMP_LOST_PERM_LOST = 5; public final static int TOKEN_TERMINATED = 6; @@ -59,7 +59,7 @@ public class TokenStatus { public final static TokenStatus UNINITIALIZED = new TokenStatus("UNINITIALIZED", TOKEN_UNINITIALIZED); public final static TokenStatus DAMAGED = new TokenStatus("DAMAGED", TOKEN_DAMAGED); public final static TokenStatus PERM_LOST = new TokenStatus("PERM_LOST", TOKEN_PERM_LOST); - public final static TokenStatus TEMP_LOST = new TokenStatus("TEMP_LOST", TOKEN_TEMP_LOST); + public final static TokenStatus SUSPENDED = new TokenStatus("SUSPENDED", TOKEN_SUSPENDED); public final static TokenStatus ACTIVE = new TokenStatus("ACTIVE", TOKEN_ACTIVE); public final static TokenStatus TEMP_LOST_PERM_LOST = new TokenStatus("TEMP_LOST_PERM_LOST", TOKEN_TEMP_LOST_PERM_LOST); public final static TokenStatus TERMINATED = new TokenStatus("TERMINATED", TOKEN_TERMINATED); @@ -136,6 +136,11 @@ public class TokenStatus { public static TokenStatus valueOf(String name) { + if ("TEMP_LOST".equals(name)) { + System.err.println("WARNING: The token status " + name + " has been deprecated. Please use SUSPENDED instead."); + return SUSPENDED; + } + TokenStatus status = instancesByName.get(name); if (status == null) { diff --git a/base/tps-client/doc/CS.cfg.in b/base/tps-client/doc/CS.cfg.in index f1a79032a..bf32630a6 100644 --- a/base/tps-client/doc/CS.cfg.in +++ b/base/tps-client/doc/CS.cfg.in @@ -1485,7 +1485,7 @@ tokendb._067=# - has transitions between the following states tokendb._068=# UNINITIALIZED = 0, tokendb._069=# DAMAGED = 1, tokendb._070=# PERM_LOST = 2, -tokendb._071=# TEMP_LOST = 3, +tokendb._071=# SUSPENDED = 3, tokendb._072=# ACTIVE = 4, tokendb._073=# TEMP_LOST_PERM_LOST = 5, tokendb._074=# TERMINATED = 6 @@ -1595,7 +1595,7 @@ tps._009=# - token operations, like formatting and enrollment have transitions tps._010=# UNINITIALIZED = 0, tps._011=# DAMAGED = 1, tps._012=# PERM_LOST = 2, -tps._013=# TEMP_LOST =3 , +tps._013=# SUSPENDED = 3, tps._014=# ACTIVE = 4, tps._015=# TEMP_LOST_PERM_LOST = 5, tps._016=# TERMINATED = 6 diff --git a/base/tps/shared/conf/CS.cfg.in b/base/tps/shared/conf/CS.cfg.in index 39e504976..b5441a0a1 100644 --- a/base/tps/shared/conf/CS.cfg.in +++ b/base/tps/shared/conf/CS.cfg.in @@ -1957,7 +1957,7 @@ tokendb._067=# - has transitions between the following states tokendb._068=# UNINITIALIZED = 0, tokendb._069=# DAMAGED = 1, tokendb._070=# PERM_LOST = 2, -tokendb._071=# TEMP_LOST = 3, +tokendb._071=# SUSPENDED = 3, tokendb._072=# ACTIVE = 4, tokendb._073=# TEMP_LOST_PERM_LOST = 5, tokendb._074=# TERMINATED = 6 @@ -2026,7 +2026,7 @@ tps._009=# - token operations, like formatting and enrollment have transitions tps._010=# UNINITIALIZED = 0, tps._011=# DAMAGED = 1, tps._012=# PERM_LOST = 2, -tps._013=# TEMP_LOST = 3, +tps._013=# SUSPENDED = 3, tps._014=# ACTIVE = 4, tps._015=# TEMP_LOST_PERM_LOST = 5, tps._016=# TERMINATED = 6 diff --git a/base/tps/shared/conf/token-states.properties b/base/tps/shared/conf/token-states.properties index a64d940c6..3c7e7d6da 100644 --- a/base/tps/shared/conf/token-states.properties +++ b/base/tps/shared/conf/token-states.properties @@ -1,7 +1,7 @@ # Token states UNINITIALIZED = Uninitialized ACTIVE = Active -TEMP_LOST = Temporarily lost +SUSPENDED = Temporarily lost/suspended PERM_LOST = Permanently lost DAMAGED = Physically damaged TEMP_LOST_PERM_LOST = Temporarily lost then permanently lost @@ -10,13 +10,13 @@ TERMINATED = Terminated # Token state transitions UNINITIALIZED.DAMAGED = This token has been physically damaged. UNINITIALIZED.PERM_LOST = This token has been permanently lost. -UNINITIALIZED.TEMP_LOST = This token has been temporarily lost. +UNINITIALIZED.SUSPENDED = This token has been temporarily lost/suspended. UNINITIALIZED.TERMINATED = This token has been terminated. -TEMP_LOST.ACTIVE = This temporarily lost token has been found. -TEMP_LOST.PERM_LOST = This temporarily lost token has become permanently lost. -TEMP_LOST.TERMINATED = This temporarily lost token has been terminated. -TEMP_LOST.UNINITIALIZED = This temporarily lost token has been found. +SUSPENDED.ACTIVE = This temporarily lost/suspended token has been found. +SUSPENDED.PERM_LOST = This temporarily lost/suspended token has become permanently lost. +SUSPENDED.TERMINATED = This temporarily lost/suspended token has been terminated. +SUSPENDED.UNINITIALIZED = This temporarily lost/suspended token has been found. ACTIVE.DAMAGED = This token has been physically damaged. ACTIVE.PERM_LOST = This token has been permanently lost. -ACTIVE.TEMP_LOST = This token has been temporarily lost. +ACTIVE.SUSPENDED = This token has been temporarily lost/suspended. ACTIVE.TERMINATED = This token has been terminated. diff --git a/base/tps/shared/webapps/tps/js/token.js b/base/tps/shared/webapps/tps/js/token.js index e09fa5fc6..c81e2ccb8 100644 --- a/base/tps/shared/webapps/tps/js/token.js +++ b/base/tps/shared/webapps/tps/js/token.js @@ -23,7 +23,7 @@ var TokenStatus = { UNINITIALIZED : "Uninitialized", ACTIVE : "Active", - TEMP_LOST : "Temporarily lost", + SUSPENDED : "Temporarily lost/suspended", PERM_LOST : "Permanently lost", DAMAGED : "Physically damaged", TEMP_LOST_PERM_LOST : "Temporarily lost then permanently lost", diff --git a/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java b/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java index 008f61333..b0ffb7570 100644 --- a/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java +++ b/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java @@ -145,7 +145,7 @@ public class TPSSubsystem implements IAuthority, ISubsystem { /** * Return the allowed next states for a given token based on TPS configuration. * - * If the current state is TEMP_LOST, token will be allowed transition to either + * If the current state is SUSPENDED, token will be allowed transition to either * UNINITIALIZED or ACTIVE depending on whether the token has certificates. * * @param tokenRecord @@ -156,7 +156,7 @@ public class TPSSubsystem implements IAuthority, ISubsystem { TokenStatus currentState = tokenRecord.getTokenStatus(); Collection nextStates = allowedTransitions.get(currentState); - if (currentState == TokenStatus.TEMP_LOST) { + if (currentState == TokenStatus.SUSPENDED) { Collection ns = new LinkedHashSet(); diff --git a/base/tps/src/org/dogtagpki/server/tps/dbs/TokenRecord.java b/base/tps/src/org/dogtagpki/server/tps/dbs/TokenRecord.java index a1aef5720..80fd30eb8 100644 --- a/base/tps/src/org/dogtagpki/server/tps/dbs/TokenRecord.java +++ b/base/tps/src/org/dogtagpki/server/tps/dbs/TokenRecord.java @@ -258,7 +258,7 @@ public class TokenRecord extends DBRecord { return TokenStatus.DAMAGED; } else if ("onHold".equals(reason)) { - return TokenStatus.TEMP_LOST; + return TokenStatus.SUSPENDED; } } else if ("terminated".equals(status)) { diff --git a/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java b/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java index 46a3c12d6..cc68c8ad3 100644 --- a/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java +++ b/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java @@ -98,7 +98,7 @@ public class TokenService extends PKIService implements TokenResource { break; case TokenStatus.TOKEN_ACTIVE: - if (tokenRecord.getTokenStatus() == TokenStatus.TEMP_LOST) { + if (tokenRecord.getTokenStatus() == TokenStatus.SUSPENDED) { // unrevoke certs tps.tdb.unRevokeCertsByCUID(tokenRecord.getId(), ipAddress, remoteUser); } @@ -129,7 +129,7 @@ public class TokenService extends PKIService implements TokenResource { tps.tdb.revokeCertsByCUID(tokenRecord.getId(), "destroyed", ipAddress, remoteUser); break; - case TokenStatus.TOKEN_TEMP_LOST: + case TokenStatus.TOKEN_SUSPENDED: tokenRecord.setStatus("lost"); newStatus = "lost"; tokenRecord.setReason("onHold"); -- cgit