import org.apache.commons.logging.LogFactory;\r
\r
import uk.ac.vamsas.client.SessionHandle;\r
+import uk.ac.vamsas.client.simpleclient.SimpleSessionHandle;\r
\r
/**\r
* @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>\r
* \r
* @return list of clients\r
*/\r
- private SessionHandle[] retrieveSessionHandles() {\r
+ private SimpleSessionHandle[] retrieveSessionHandles() {\r
if (lockFile()) {\r
try {\r
- SessionHandle[] sessions = null;\r
+ SimpleSessionHandle[] sessions = null;\r
if (this.fileLock.length() > 0) {\r
\r
ObjectInputStream is = new ObjectInputStream(this.fileLock\r
o = is.readObject();\r
if (o != null) {\r
try {\r
- sessions = (SessionHandle[]) o;\r
+ sessions = (SimpleSessionHandle[]) o;\r
} catch (Exception e) {\r
log.error("Garbage in the clientHandle list " + this.sessionFile,\r
e);\r
* \r
* @return sessionsList\r
*/\r
- public SessionHandle[] retrieveSessionsList() {\r
+ public SimpleSessionHandle[] retrieveSessionsList() {\r
if (lockFile()) {\r
- SessionHandle[] clients = retrieveSessionHandles();\r
+ SimpleSessionHandle[] clients = retrieveSessionHandles();\r
unlockFile();\r
return clients;\r
}\r
* @param extantlock\r
* @return sessionList or null if lock failed (or file was empty)\r
*/\r
- public SessionHandle[] retrieveSessionsList(Lock extantlock) {\r
+ public SimpleSessionHandle[] retrieveSessionsList(Lock extantlock) {\r
if (lockFile(extantlock)) {\r
- SessionHandle[] sessions = retrieveSessionHandles();\r
+ SimpleSessionHandle[] sessions = retrieveSessionHandles();\r
unlockFile();\r
return sessions;\r
}\r
* @return session index in list or 0 if lock was invalid or addSession\r
* operation failed.\r
*/\r
- public int addSession(SessionHandle newSession, Lock extantLock) {\r
+ public int addSession(SimpleSessionHandle newSession, Lock extantLock) {\r
return addSession(newSession, true, extantLock);\r
}\r
\r
* @return client index in list or 0 if addSession (or the lock) failed.\r
*/\r
\r
- public int addSession(SessionHandle newSession, boolean disambig,\r
+ public int addSession(SimpleSessionHandle newSession, boolean disambig,\r
Lock extantLock) {\r
if (lockFile(extantLock)) {\r
this.syncnum = addSession(newSession, disambig);\r
int mynum = -1;\r
if (lockFile(sessionlock)) {\r
\r
- SessionHandle[] sessions = retrieveSessionHandles();\r
+ SimpleSessionHandle[] sessions = retrieveSessionHandles();\r
if (sessions != null) {\r
if ((this.syncnum <= 0 || this.syncnum > sessions.length)\r
- || !sessions[this.syncnum - 1].equals(session)) {\r
+ || !session.equals(sessions[this.syncnum - 1])) {\r
for (int i = 0, j = sessions.length; i < j; i++) {\r
if (sessions[i].equals(session)) {\r
mynum = i;\r
}\r
\r
if (mynum > -1) {\r
- SessionHandle[] newlist = new SessionHandle[sessions.length - 1];\r
+ SimpleSessionHandle[] newlist = new SimpleSessionHandle[sessions.length - 1];\r
for (int k = 0, i = 0, j = sessions.length; i < j; i++)\r
if (i != mynum)\r
newlist[k++] = sessions[i];\r
* @return index of sessionHandle in new list, or -1-position of existing\r
* sessionHandle (if disambiguate is true)\r
*/\r
- protected int addSession(SessionHandle session, boolean disambiguate) {\r
+ protected int addSession(SimpleSessionHandle session, boolean disambiguate) {\r
int newsession = 0;\r
int tries = 5;\r
while (tries-- > 0 && !lockFile())\r
}\r
;\r
if (lockFile()) {\r
- SessionHandle[] sessions = retrieveSessionHandles();\r
+ SimpleSessionHandle[] sessions = retrieveSessionHandles();\r
\r
if (sessions == null) {\r
- sessions = new SessionHandle[1];\r
+ sessions = new SimpleSessionHandle[1];\r
sessions[0] = session;\r
newsession = 1;\r
} else {\r
}\r
}\r
int i, j;\r
- SessionHandle[] newlist = new SessionHandle[sessions.length + 1];\r
+ SimpleSessionHandle[] newlist = new SimpleSessionHandle[sessions.length + 1];\r
for (i = 0, j = sessions.length; i < j; i++)\r
newlist[i] = sessions[i];\r
newlist[j] = session;\r
* @param clients\r
* @return true if successful write. Throws Errors otherwise.\r
*/\r
- protected boolean putSessionsList(SessionHandle[] clients) {\r
+ protected boolean putSessionsList(SimpleSessionHandle[] clients) {\r
if (lockFile()) {\r
File templist = null;\r
if (!this.backup || (templist = backupSessionFile()) != null) {\r