diff options
Diffstat (limited to 'base')
11 files changed, 36 insertions, 31 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 f3dd73e38..f570c125d 100644 --- a/base/common/src/com/netscape/certsrv/tps/token/TokenStatus.java +++ b/base/common/src/com/netscape/certsrv/tps/token/TokenStatus.java @@ -48,7 +48,7 @@ public class TokenStatus { static Map<String, TokenStatus> instancesByName = new HashMap<String, TokenStatus>(); static Map<Integer, TokenStatus> instancesByValue = new HashMap<Integer, TokenStatus>(); - public final static int TOKEN_UNINITIALIZED = 0; + public final static int TOKEN_READY = 0; public final static int TOKEN_DAMAGED = 1; public final static int TOKEN_PERM_LOST = 2; public final static int TOKEN_SUSPENDED = 3; @@ -56,7 +56,7 @@ public class TokenStatus { public final static int TOKEN_TEMP_LOST_PERM_LOST = 5; public final static int TOKEN_TERMINATED = 6; - public final static TokenStatus UNINITIALIZED = new TokenStatus("UNINITIALIZED", TOKEN_UNINITIALIZED); + public final static TokenStatus READY = new TokenStatus("READY", TOKEN_READY); 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 SUSPENDED = new TokenStatus("SUSPENDED", TOKEN_SUSPENDED); @@ -136,6 +136,11 @@ public class TokenStatus { public static TokenStatus valueOf(String name) { + if ("UNINITIALIZED".equals(name)) { + System.err.println("WARNING: The token status " + name + " has been deprecated. Please use READY instead."); + return READY; + } + if ("TEMP_LOST".equals(name)) { System.err.println("WARNING: The token status " + name + " has been deprecated. Please use SUSPENDED instead."); return SUSPENDED; diff --git a/base/tps-client/doc/CS.cfg.in b/base/tps-client/doc/CS.cfg.in index bf32630a6..e15fc5332 100644 --- a/base/tps-client/doc/CS.cfg.in +++ b/base/tps-client/doc/CS.cfg.in @@ -1482,7 +1482,7 @@ tokendb._064=# is set to YES. Otherwise, re-enrollment is not tokendb._065=# allowed. tokendb._066=# tokendb.allowedTransitions: tokendb._067=# - has transitions between the following states -tokendb._068=# UNINITIALIZED = 0, +tokendb._068=# READY = 0, tokendb._069=# DAMAGED = 1, tokendb._070=# PERM_LOST = 2, tokendb._071=# SUSPENDED = 3, @@ -1592,7 +1592,7 @@ tps._005=# tps.cert.subsystem.nickname=xxx tps._007=# tps.cert.audit_signing.nickname=xxx tps._008=# operations.allowedTransitions: tps._009=# - token operations, like formatting and enrollment have transitions between the following states -tps._010=# UNINITIALIZED = 0, +tps._010=# READY = 0, tps._011=# DAMAGED = 1, tps._012=# PERM_LOST = 2, tps._013=# SUSPENDED = 3, diff --git a/base/tps/shared/conf/CS.cfg.in b/base/tps/shared/conf/CS.cfg.in index b5441a0a1..2b451defc 100644 --- a/base/tps/shared/conf/CS.cfg.in +++ b/base/tps/shared/conf/CS.cfg.in @@ -1954,7 +1954,7 @@ tokendb._064=# is set to YES. Otherwise, re-enrollment is not tokendb._065=# allowed. tokendb._066=# tokendb.allowedTransitions: tokendb._067=# - has transitions between the following states -tokendb._068=# UNINITIALIZED = 0, +tokendb._068=# READY = 0, tokendb._069=# DAMAGED = 1, tokendb._070=# PERM_LOST = 2, tokendb._071=# SUSPENDED = 3, @@ -2023,7 +2023,7 @@ tps._005=# tps.cert.subsystem.nickname=xxx tps._007=# tps.cert.audit_signing.nickname=xxx tps._008=# operations.allowedTransitions: tps._009=# - token operations, like formatting and enrollment have transitions between the following states -tps._010=# UNINITIALIZED = 0, +tps._010=# READY = 0, tps._011=# DAMAGED = 1, tps._012=# PERM_LOST = 2, tps._013=# SUSPENDED = 3, diff --git a/base/tps/shared/conf/token-states.properties b/base/tps/shared/conf/token-states.properties index 3c7e7d6da..e6366286f 100644 --- a/base/tps/shared/conf/token-states.properties +++ b/base/tps/shared/conf/token-states.properties @@ -1,5 +1,5 @@ # Token states -UNINITIALIZED = Uninitialized +READY = Uninitialized/ready ACTIVE = Active SUSPENDED = Temporarily lost/suspended PERM_LOST = Permanently lost @@ -8,14 +8,14 @@ TEMP_LOST_PERM_LOST = Temporarily lost then permanently lost TERMINATED = Terminated # Token state transitions -UNINITIALIZED.DAMAGED = This token has been physically damaged. -UNINITIALIZED.PERM_LOST = This token has been permanently lost. -UNINITIALIZED.SUSPENDED = This token has been temporarily lost/suspended. -UNINITIALIZED.TERMINATED = This token has been terminated. +READY.DAMAGED = This token has been physically damaged. +READY.PERM_LOST = This token has been permanently lost. +READY.SUSPENDED = This token has been temporarily lost/suspended. +READY.TERMINATED = This token has been terminated. 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. +SUSPENDED.READY = 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.SUSPENDED = This token has been temporarily lost/suspended. diff --git a/base/tps/shared/webapps/tps/js/token.js b/base/tps/shared/webapps/tps/js/token.js index c81e2ccb8..2bcf9e11e 100644 --- a/base/tps/shared/webapps/tps/js/token.js +++ b/base/tps/shared/webapps/tps/js/token.js @@ -21,7 +21,7 @@ // TODO: load labels from server var TokenStatus = { - UNINITIALIZED : "Uninitialized", + READY : "Uninitialized/ready", ACTIVE : "Active", SUSPENDED : "Temporarily lost/suspended", PERM_LOST : "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 b0ffb7570..7e4a92be0 100644 --- a/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java +++ b/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java @@ -146,7 +146,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 SUSPENDED, token will be allowed transition to either - * UNINITIALIZED or ACTIVE depending on whether the token has certificates. + * READY or ACTIVE depending on whether the token has certificates. * * @param tokenRecord * @return A non-null collection of allowed next token states. @@ -163,9 +163,9 @@ public class TPSSubsystem implements IAuthority, ISubsystem { // check token certificates Collection<TPSCertRecord> certRecords = tdb.tdbGetCertRecordsByCUID(tokenRecord.getId()); - // if token has no certificates, allow token to become uninitialized again + // if token has no certificates, allow token to become ready again if (certRecords.isEmpty()) { - ns.add(TokenStatus.UNINITIALIZED); + ns.add(TokenStatus.READY); } else { // otherwise, allow token to become active again ns.add(TokenStatus.ACTIVE); diff --git a/base/tps/src/org/dogtagpki/server/tps/TPSTokendb.java b/base/tps/src/org/dogtagpki/server/tps/TPSTokendb.java index e69ce9359..4a4aa89d3 100644 --- a/base/tps/src/org/dogtagpki/server/tps/TPSTokendb.java +++ b/base/tps/src/org/dogtagpki/server/tps/TPSTokendb.java @@ -186,7 +186,7 @@ public class TPSTokendb { } catch (Exception e) { CMS.debug("TPSTokendb.tdbUpdateTokenEntry: token entry not found; Adding"); // add and exit - tdbAddTokenEntry(tokenRecord, "uninitialized"); + tdbAddTokenEntry(tokenRecord, "ready"); return; } // token found; modify 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 80fd30eb8..e8b0c5d9f 100644 --- a/base/tps/src/org/dogtagpki/server/tps/dbs/TokenRecord.java +++ b/base/tps/src/org/dogtagpki/server/tps/dbs/TokenRecord.java @@ -242,8 +242,8 @@ public class TokenRecord extends DBRecord { public TokenStatus getTokenStatus() { String status = getStatus(); - if ("uninitialized".equals(status)) { - return TokenStatus.UNINITIALIZED; + if ("ready".equals(status)) { + return TokenStatus.READY; } else if ("active".equals(status)) { return TokenStatus.ACTIVE; diff --git a/base/tps/src/org/dogtagpki/server/tps/processor/TPSEnrollProcessor.java b/base/tps/src/org/dogtagpki/server/tps/processor/TPSEnrollProcessor.java index 19df79f53..4e8c8abfb 100644 --- a/base/tps/src/org/dogtagpki/server/tps/processor/TPSEnrollProcessor.java +++ b/base/tps/src/org/dogtagpki/server/tps/processor/TPSEnrollProcessor.java @@ -319,7 +319,7 @@ public class TPSEnrollProcessor extends TPSProcessor { } } else { CMS.debug(method + " token does not exist"); - tokenRecord.setStatus("uninitialized"); + tokenRecord.setStatus("ready"); checkAllowUnknownToken(TPSEngine.OP_FORMAT_PREFIX); } @@ -368,7 +368,7 @@ public class TPSEnrollProcessor extends TPSProcessor { if (!isTokenPresent) { try { - tps.tdb.tdbAddTokenEntry(tokenRecord, "uninitialized"); + tps.tdb.tdbAddTokenEntry(tokenRecord, "ready"); } catch (Exception e) { String failMsg = "add token failure"; logMsg = failMsg + ":" + e.toString(); @@ -1031,7 +1031,7 @@ public class TPSEnrollProcessor extends TPSProcessor { //same token logMsg = "found current token entry"; CMS.debug(method + ":" + logMsg); - if (tokenRecord.getStatus().equals("uninitialized")) { + if (tokenRecord.getStatus().equals("ready")) { // this is the current token if (tokenRecords.size() == 1) { // the current token is the only token owned by the user diff --git a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java index 01cde7608..0a0b10d46 100644 --- a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java +++ b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java @@ -2055,8 +2055,8 @@ public class TPSProcessor { if (isTokenPresent) { CMS.debug("TPSProcessor.format: token exists"); - TokenStatus newState = TokenStatus.UNINITIALIZED; - // Check for transition to 0/UNINITIALIZED status. + TokenStatus newState = TokenStatus.READY; + // Check for transition to 0/READY status. if (!tps.engine.isOperationTransitionAllowed(tokenRecord.getTokenStatus(), newState)) { String info = " illegal transition attempted: " + tokenRecord.getTokenStatus() + @@ -2151,7 +2151,7 @@ public class TPSProcessor { } // Update Token DB - tokenRecord.setStatus("uninitialized"); + tokenRecord.setStatus("ready"); try { tps.tdb.tdbUpdateTokenEntry(tokenRecord); } catch (Exception e) { 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 cc68c8ad3..441518e8b 100644 --- a/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java +++ b/base/tps/src/org/dogtagpki/server/tps/rest/TokenService.java @@ -91,9 +91,9 @@ public class TokenService extends PKIService implements TokenResource { auditModParams.put("UserID", tokenRecord.getUserID()); switch (tokenState.getValue()) { - case TokenStatus.TOKEN_UNINITIALIZED: - tokenRecord.setStatus("uninitialized"); - newStatus = "uninitialized"; + case TokenStatus.TOKEN_READY: + tokenRecord.setStatus("ready"); + newStatus = "ready"; tokenRecord.setReason(null); break; @@ -377,9 +377,9 @@ public class TokenService extends PKIService implements TokenResource { auditModParams.put("Policy", policy); } - // new tokens are uninitialized when created - tokenRecord.setStatus("uninitialized"); - auditModParams.put("Status", "uninitialized"); + // new tokens are ready when created + tokenRecord.setStatus("ready"); + auditModParams.put("Status", "ready"); database.addRecord(tokenID, tokenRecord); subsystem.tdb.tdbActivity(ActivityDatabase.OP_ADD, tokenRecord, |