X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Forg%2Fvamsas%2Fclient%2Fsimpleclient%2FIdFactory.java;h=79ec47cab5431d02529d962d3e43e15f78137032;hb=2b329d524c11576c358e631d2005640fd51b1c55;hp=c046af590ba3e96ce7123acb843c6a33a1f5fab7;hpb=8d474dd77c01354948a5db3ee135e04af8f97503;p=vamsas.git diff --git a/src/org/vamsas/client/simpleclient/IdFactory.java b/src/org/vamsas/client/simpleclient/IdFactory.java index c046af5..79ec47c 100644 --- a/src/org/vamsas/client/simpleclient/IdFactory.java +++ b/src/org/vamsas/client/simpleclient/IdFactory.java @@ -26,7 +26,7 @@ public class IdFactory extends VorbaIdFactory { private UserHandle user; private CRC32 unique=new CRC32(); // used to attempt a unique but predictable stream for IDs private String idstring; - int sequence=0; // incrementing value for next new ID + int sequence=1; // incrementing value for next new ID /** * */ @@ -47,8 +47,8 @@ public class IdFactory extends VorbaIdFactory { this.user = user; unique.reset(); unique.update(new Object[] { session, client, user}.toString().getBytes()); - idstring = "vamsas:"+session.getSessionUrn()+":"+unique.getValue()+":"+client.getClientUrn()+"/"; - sequence=0; + // TODO: Ensure format of URNs and use standard composition methods. + idstring = client.getClientUrn()+":"+unique.getValue()+"/"; extantids=new Hashtable(); } @@ -60,10 +60,11 @@ public class IdFactory extends VorbaIdFactory { throw new Error("makeVorbaId called on improperly initialised IdFactory object!"); String newidstring; do { - if (sequence!=0) { + if (sequence>0) { sequence++; } else { idstring+="1/"; + sequence=1; } newidstring=idstring+Integer.toString(sequence); } while (extantids.containsKey(newidstring));