2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.bin.Cache;
24 import jalview.datamodel.AlignmentI;
25 import jalview.datamodel.ColumnSelection;
26 import jalview.datamodel.SequenceGroup;
27 import jalview.datamodel.SequenceI;
28 import jalview.io.VamsasAppDatastore;
29 import jalview.structure.SelectionListener;
30 import jalview.structure.SelectionSource;
31 import jalview.structure.StructureSelectionManager;
32 import jalview.structure.VamsasListener;
33 import jalview.structure.VamsasSource;
35 import java.beans.PropertyChangeEvent;
36 import java.beans.PropertyChangeListener;
38 import java.io.IOException;
39 import java.util.Enumeration;
40 import java.util.Hashtable;
41 import java.util.IdentityHashMap;
42 import java.util.Iterator;
44 import javax.swing.JInternalFrame;
45 import javax.swing.JOptionPane;
47 import uk.ac.vamsas.client.ClientHandle;
48 import uk.ac.vamsas.client.IClient;
49 import uk.ac.vamsas.client.IClientDocument;
50 import uk.ac.vamsas.client.InvalidSessionDocumentException;
51 import uk.ac.vamsas.client.UserHandle;
52 import uk.ac.vamsas.client.VorbaId;
53 import uk.ac.vamsas.client.picking.IMessageHandler;
54 import uk.ac.vamsas.client.picking.IPickManager;
55 import uk.ac.vamsas.client.picking.Message;
56 import uk.ac.vamsas.client.picking.MouseOverMessage;
57 import uk.ac.vamsas.client.picking.SelectionMessage;
58 import uk.ac.vamsas.objects.core.Entry;
59 import uk.ac.vamsas.objects.core.Input;
60 import uk.ac.vamsas.objects.core.Pos;
61 import uk.ac.vamsas.objects.core.Seg;
67 public class VamsasApplication implements SelectionSource, VamsasSource
69 IClient vclient = null;
71 ClientHandle app = null;
73 UserHandle user = null;
75 Desktop jdesktop = null; // our jalview desktop reference
77 private boolean inInitialUpdate = true;
79 // Cache.preferences for vamsas client session arena
80 // preferences for check for default session at startup.
81 // user and organisation stuff.
82 public VamsasApplication(Desktop jdesktop, File sessionPath,
86 // we should create a session URI from the sessionPath and pass it to
87 // the clientFactory - but the vamsas api doesn't cope with that yet.
88 this.jdesktop = jdesktop;
89 initClientSession(null, sessionPath, sessionName);
92 private static uk.ac.vamsas.client.IClientFactory getClientFactory()
95 return new uk.ac.vamsas.client.simpleclient.SimpleClientFactory();
99 * Start a new vamsas session
103 public VamsasApplication(Desktop jdesktop)
105 this.jdesktop = jdesktop;
106 initClientSession(null, null);
110 * init a connection to the session at the given url
115 public VamsasApplication(Desktop jdesktop, String sessionUrl)
117 this.jdesktop = jdesktop;
118 initClientSession(sessionUrl, null);
122 * @throws IOException
123 * or other if clientfactory instantiation failed.
124 * @return list of current sessions or null if no session exists.
126 public static String[] getSessionList() throws Exception
128 return getClientFactory().getCurrentSessions();
132 * initialise, possibly with either a valid session url or a file for a new
136 * null or a valid session url
137 * @param vamsasDocument
138 * null or a valid vamsas document file
139 * @return false if no vamsas connection was made
141 private void initClientSession(String sess, File vamsasDocument)
143 initClientSession(sess, vamsasDocument, null);
146 private boolean initClientSession(String sess, File vamsasDocument,
147 String newDocSessionName)
151 // Only need to tell the library what the application is here
152 app = getJalviewHandle();
153 uk.ac.vamsas.client.IClientFactory clientfactory = getClientFactory();
154 if (vamsasDocument != null)
159 "Implementation Error - cannot import existing vamsas document into an existing session, Yet!");
163 if (newDocSessionName != null)
165 vclient = clientfactory.openAsNewSessionIClient(app,
166 vamsasDocument, newDocSessionName);
170 vclient = clientfactory.openAsNewSessionIClient(app,
173 } catch (InvalidSessionDocumentException e)
176 .showInternalMessageDialog(
179 "VAMSAS Document could not be opened as a new session - please choose another",
180 "VAMSAS Document Import Failed",
181 JOptionPane.ERROR_MESSAGE);
187 // join existing or create a new session
190 vclient = clientfactory.getNewSessionIClient(app);
194 vclient = clientfactory.getIClient(app, sess);
197 // set some properties for our VAMSAS interaction
199 user = vclient.getUserHandle();
201 } catch (Exception e)
203 jalview.bin.Cache.log
204 .error("Couldn't instantiate vamsas client !", e);
210 private void setVclientConfig()
218 if (vclient instanceof uk.ac.vamsas.client.simpleclient.SimpleClient)
220 uk.ac.vamsas.client.simpleclient.SimpleClientConfig cfg = ((uk.ac.vamsas.client.simpleclient.SimpleClient) vclient)
221 .getSimpleClientConfig();
222 cfg._validatemergedroots = false;
223 cfg._validateupdatedroots = true; // we may write rubbish otherwise.
228 .warn("Probable SERIOUS VAMSAS client incompatibility - carrying on regardless",
230 } catch (Exception e)
233 .warn("Probable VAMSAS client incompatibility - carrying on regardless",
239 * make the appHandle for Jalview
243 private ClientHandle getJalviewHandle()
245 return new ClientHandle("jalview.bin.Jalview",
246 jalview.bin.Cache.getProperty("VERSION"));
251 * @return true if we are registered in a vamsas session
253 public boolean inSession()
255 return (vclient != null);
259 * called to connect to session inits handlers, does an initial document
262 public void initial_update()
267 "Impementation error! Vamsas Operations when client not initialised and connected.");
269 addDocumentUpdateHandler();
270 addStoreDocumentHandler();
272 inInitialUpdate = true;
274 .debug("Jalview loading the Vamsas Session for the first time.");
275 dealWithDocumentUpdate(false); // we don't push an update out to the
276 inInitialUpdate = false;
278 Cache.log.debug("... finished update for the first time.");
282 * Update all windows after a vamsas datamodel change. this could go on the
286 protected void updateJalviewGui()
288 JInternalFrame[] frames = jdesktop.getAllFrames();
298 for (int i = frames.length - 1; i > -1; i--)
300 if (frames[i] instanceof AlignFrame)
302 AlignFrame af = (AlignFrame) frames[i];
303 af.alignPanel.alignmentChanged();
306 } catch (Exception e)
309 .warn("Exception whilst refreshing jalview windows after a vamsas document update.",
314 public void push_update()
316 Thread udthread = new Thread(new Runnable()
321 Cache.log.info("Jalview updating to the Vamsas Session.");
323 dealWithDocumentUpdate(true);
324 Cache.log.info("Jalview finished updating to the Vamsas Session.");
332 * leave a session, prompting the user to save if necessary
334 public void end_session()
339 private boolean promptUser = true;
342 * leave a session, optionally prompting the user to save if necessary
345 * when true enable prompting by this application
348 public void end_session(boolean promptUser)
351 throw new Error("Jalview not connected to Vamsas session.");
352 Cache.log.info("Jalview disconnecting from the Vamsas Session.");
357 boolean ourprompt = this.promptUser;
358 this.promptUser = promptUser;
359 vclient.finalizeClient();
360 Cache.log.info("Jalview has left the session.");
361 this.promptUser = ourprompt; // restore default value
366 .warn("JV Client leaving a session that's its not joined yet.");
368 joinedSession = false;
374 } catch (Exception e)
376 Cache.log.error("Vamsas Session finalization threw exceptions!", e);
380 public void updateJalview(IClientDocument cdoc)
382 Cache.log.debug("Jalview updating from sesion document ..");
384 VamsasAppDatastore vds = new VamsasAppDatastore(cdoc, vobj2jv, jv2vobj,
385 baseProvEntry(), alRedoState);
388 vds.updateToJalview();
389 } catch (Exception e)
391 Cache.log.error("Failed to update Jalview from vamsas document.", e);
397 vds.updateJalviewFromAppdata();
398 // Comment this out to repeatedly read in data from JalviewAppData
399 // firstUpdate=false;
401 } catch (Exception e)
404 "Exception when updating Jalview settings from Appdata.", e);
406 Cache.log.debug(".. finished updating from sesion document.");
410 boolean firstUpdate = false;
412 private void ensureJvVamsas()
416 jv2vobj = new IdentityHashMap();
417 vobj2jv = new Hashtable();
418 alRedoState = new Hashtable();
424 * jalview object binding to VorbaIds
426 IdentityHashMap jv2vobj = null;
428 Hashtable vobj2jv = null;
430 Hashtable alRedoState = null;
432 boolean errorsDuringUpdate = false;
434 boolean errorsDuringAppUpdate = false;
437 * update the document accessed through doc. A backup of the current object
441 * @return number of views stored in document (updated and new views)
443 public int updateVamsasDocument(IClientDocument doc)
447 errorsDuringUpdate = false;
448 errorsDuringAppUpdate = false;
449 backup_objectMapping();
450 VamsasAppDatastore vds = new VamsasAppDatastore(doc, vobj2jv, jv2vobj,
451 baseProvEntry(), alRedoState);
452 // wander through frames
453 JInternalFrame[] frames = Desktop.desktop.getAllFrames();
459 Hashtable skipList = new Hashtable();
460 Hashtable viewset = new Hashtable();
465 for (int i = frames.length - 1; i > -1; i--)
467 if (frames[i] instanceof AlignFrame)
469 AlignFrame af = (AlignFrame) frames[i];
470 if (!viewset.containsKey(af.getViewport().getSequenceSetId()))
472 // update alignment and root from frame.
473 boolean stored = false;
476 stored = vds.storeVAMSAS(af.getViewport(), af.getTitle());
477 } catch (Exception e)
479 errorsDuringUpdate = true;
480 Cache.log.error("Exception synchronizing "
483 + (af.getViewport().viewName == null ? "" : " view "
484 + af.getViewport().viewName)
485 + " to document.", e);
489 { // record skip in skipList
490 skipList.put(af.getViewport().getSequenceSetId(), af);
495 // could try to eliminate sequenceSetId from skiplist ..
496 // (skipList.containsKey(af.getViewport().getSequenceSetId()))
497 // remember sequenceSetId so we can skip all the other views on
499 viewset.put(af.getViewport().getSequenceSetId(), af);
505 // for (int i = frames.length - 1; i > -1; i--)
507 // if (frames[i] instanceof AlignFrame)
509 // AlignFrame af = (AlignFrame) frames[i];
510 Iterator aframes = viewset.values().iterator();
511 while (aframes.hasNext())
513 AlignFrame af = (AlignFrame) aframes.next();
514 // add any AlignedCodonFrame mappings on this alignment to any other.
515 vds.storeSequenceMappings(af.getViewport(), af.getTitle());
517 } catch (Exception e)
519 Cache.log.error("Exception synchronizing Views to Document :", e);
520 errorsDuringUpdate = true;
525 if (viewset.size() > 0)
527 // Alignment views were synchronized, so store their state in the
529 // The skipList ensures we don't write out any alignments not actually
531 vds.setSkipList(skipList);
532 vds.updateJalviewClientAppdata();
534 } catch (Exception e)
536 Cache.log.error("Client Appdata Write exception", e);
537 errorsDuringAppUpdate = true;
543 private Entry baseProvEntry()
545 uk.ac.vamsas.objects.core.Entry pentry = new uk.ac.vamsas.objects.core.Entry();
546 pentry.setUser(user.getFullName());
547 pentry.setApp(app.getClientUrn());
548 pentry.setDate(new java.util.Date());
549 pentry.setAction("created");
554 * do a vamsas document update or update jalview from the vamsas document
557 * true to update from jalview to the vamsas document
558 * @return total number of stored alignments in the document after the update
560 protected int dealWithDocumentUpdate(boolean fromJalview)
563 // called by update handler for document update.
564 Cache.log.debug("Updating jalview from changed vamsas document.");
568 long time = System.currentTimeMillis();
569 IClientDocument cdoc = vclient.getClientDocument();
570 if (Cache.log.isDebugEnabled())
572 Cache.log.debug("Time taken to get ClientDocument = "
573 + (System.currentTimeMillis() - time));
574 time = System.currentTimeMillis();
578 storedviews += updateVamsasDocument(cdoc);
579 if (Cache.log.isDebugEnabled())
582 .debug("Time taken to update Vamsas Document from jalview\t= "
583 + (System.currentTimeMillis() - time));
584 time = System.currentTimeMillis();
586 cdoc.setVamsasRoots(cdoc.getVamsasRoots());
587 if (Cache.log.isDebugEnabled())
589 Cache.log.debug("Time taken to set Document Roots\t\t= "
590 + (System.currentTimeMillis() - time));
591 time = System.currentTimeMillis();
597 if (Cache.log.isDebugEnabled())
600 .debug("Time taken to update Jalview from vamsas document Roots\t= "
601 + (System.currentTimeMillis() - time));
602 time = System.currentTimeMillis();
606 vclient.updateDocument(cdoc);
607 if (Cache.log.isDebugEnabled())
609 Cache.log.debug("Time taken to update Session Document\t= "
610 + (System.currentTimeMillis() - time));
611 time = System.currentTimeMillis();
614 } catch (Exception ee)
616 System.err.println("Exception whilst updating :");
617 ee.printStackTrace(System.err);
618 // recover object map backup, since its probably corrupted with references
619 // to Vobjects that don't exist anymore.
620 recover_objectMappingBackup();
623 Cache.log.debug("Finished updating from document change.");
628 private void addDocumentUpdateHandler()
630 final VamsasApplication client = this;
631 vclient.addDocumentUpdateHandler(new PropertyChangeListener()
633 public void propertyChange(PropertyChangeEvent evt)
635 Cache.log.debug("Dealing with document update event.");
636 client.dealWithDocumentUpdate(false);
637 Cache.log.debug("finished dealing with event.");
640 Cache.log.debug("Added Jalview handler for vamsas document updates.");
643 private void addStoreDocumentHandler()
645 final VamsasApplication client = this;
646 vclient.addVorbaEventHandler(
647 uk.ac.vamsas.client.Events.DOCUMENT_REQUESTTOCLOSE,
648 new PropertyChangeListener()
650 public void propertyChange(PropertyChangeEvent evt)
652 if (client.promptUser)
655 .debug("Asking user if the vamsas session should be stored.");
656 int reply = JOptionPane
657 .showInternalConfirmDialog(
659 "The current VAMSAS session has unsaved data - do you want to save it ?",
660 "VAMSAS Session Shutdown",
661 JOptionPane.YES_NO_OPTION,
662 JOptionPane.QUESTION_MESSAGE);
664 if (reply == JOptionPane.YES_OPTION)
666 Cache.log.debug("Prompting for vamsas store filename.");
667 Desktop.instance.vamsasSave_actionPerformed(null);
669 .debug("Finished attempt at storing document.");
672 .debug("finished dealing with REQUESTTOCLOSE event.");
677 .debug("Ignoring store document request (promptUser==false)");
681 Cache.log.debug("Added Jalview handler for vamsas document updates.");
684 public void disableGui(boolean b)
686 Desktop.instance.setVamsasUpdate(b);
689 Hashtable _backup_vobj2jv;
691 IdentityHashMap _backup_jv2vobj;
694 * make a backup of the object mappings (vobj2jv and jv2vobj)
696 public void backup_objectMapping()
698 _backup_vobj2jv = new Hashtable(vobj2jv);
699 _backup_jv2vobj = new IdentityHashMap(jv2vobj);
703 * recover original object mappings from the object mapping backup if document
707 * if backup_objectMapping was not called.
709 public void recover_objectMappingBackup()
711 if (_backup_vobj2jv == null)
715 // nothing to recover so just
720 "IMPLEMENTATION ERROR: Cannot recover vamsas object mappings - no backup was made.");
723 Iterator el = _backup_jv2vobj.entrySet().iterator();
726 java.util.Map.Entry mp = (java.util.Map.Entry) el.next();
727 jv2vobj.put(mp.getKey(), mp.getValue());
729 el = _backup_vobj2jv.entrySet().iterator();
732 java.util.Map.Entry mp = (java.util.Map.Entry) el.next();
733 vobj2jv.put(mp.getKey(), mp.getValue());
737 private boolean joinedSession = false;
739 private VamsasListener picker = null;
741 private SelectionListener selecter;
743 private void startSession()
749 vclient.joinSession();
750 joinedSession = true;
751 } catch (Exception e)
754 Cache.log.error("Failed to join vamsas session.", e);
759 final IPickManager pm = vclient.getPickManager();
760 final StructureSelectionManager ssm = StructureSelectionManager
761 .getStructureSelectionManager(Desktop.instance);
762 final VamsasApplication me = this;
763 pm.registerMessageHandler(new IMessageHandler()
767 public void handleMessage(Message message)
771 // we are not in a session yet.
774 if (message instanceof MouseOverMessage)
776 MouseOverMessage mm = (MouseOverMessage) message;
777 String mstring = mm.getVorbaID() + " " + mm.getPosition();
778 if (last != null && mstring.equals(last))
782 // if (Cache.log.isDebugEnabled())
784 // Cache.log.debug("Received MouseOverMessage "+mm.getVorbaID()+"
785 // "+mm.getPosition());
787 Object jvobj = vobj2jv.get(mm.getVorbaID());
788 if (jvobj != null && jvobj instanceof SequenceI)
791 // Cache.log.debug("Handling Mouse over "+mm.getVorbaID()+"
792 // bound to "+jvobj+" at "+mm.getPosition());
793 // position is character position in aligned sequence
794 ssm.mouseOverVamsasSequence((SequenceI) jvobj,
795 mm.getPosition(), me);
798 if (message instanceof uk.ac.vamsas.client.picking.SelectionMessage)
800 // we only care about AlignmentSequence selections
801 SelectionMessage sm = (SelectionMessage) message;
803 System.err.println("Received\n" + sm.getRawMessage());
804 Object[] jvobjs = sm.getVorbaIDs() == null ? null
805 : new Object[sm.getVorbaIDs().length];
808 // TODO: rationalise : can only clear a selection over a
809 // referred to object
810 ssm.sendSelection(null, null, me);
815 for (int o = 0; o < jvobjs.length; o++)
817 jvobjs[o] = vobj2jv.get(sm.getVorbaIDs()[o]);
818 if (jvobjs[o] == null)
820 // can't cope with selections for unmapped objects
825 type = jvobjs[o].getClass();
828 if (type != jvobjs[o].getClass())
831 // discard - can't cope with selections over mixed objects
835 SequenceGroup jselection = null;
836 ColumnSelection colsel = null;
837 if (type == jalview.datamodel.Alignment.class)
839 if (jvobjs.length == 1)
841 // TODO if (sm.isNone())// send a message to select the
842 // specified columns over the
849 if (type == jalview.datamodel.Sequence.class)
853 boolean aligned = ((jalview.datamodel.Sequence) jvobjs[0])
854 .getDatasetSequence() != null;
858 jselection = new SequenceGroup();
859 jselection.addSequence(
860 seq = (jalview.datamodel.Sequence) jvobjs[0],
862 maxWidth = seq.getLength();
864 for (int c = 1; aligned && jvobjs.length > 1
865 && c < jvobjs.length; c++)
867 if (((jalview.datamodel.Sequence) jvobjs[c])
868 .getDatasetSequence() == null)
875 jselection.addSequence(
876 seq = (jalview.datamodel.Sequence) jvobjs[c],
878 if (maxWidth < seq.getLength())
880 maxWidth = seq.getLength();
888 // if cardinality is greater than one then verify all
889 // sequences are alignment sequences.
890 if (jvobjs.length == 1)
892 // find all instances of this dataset sequence in the
893 // displayed alignments containing the associated range and
899 jselection.setStartRes(0);
900 jselection.setEndRes(maxWidth);
901 // locate the alignment containing the given sequences and
902 // select the associated ranges on them.
903 if (sm.getRanges() != null)
905 int[] prange = uk.ac.vamsas.objects.utils.Range
906 .getBounds(sm.getRanges());
907 jselection.setStartRes(prange[0] - 1);
908 jselection.setEndRes(prange[1] - 1);
909 prange = uk.ac.vamsas.objects.utils.Range
910 .getIntervals(sm.getRanges());
911 colsel = new ColumnSelection();
912 for (int p = 0; p < prange.length; p += 2)
914 int d = (prange[p] <= prange[p + 1]) ? 1 : -1;
915 // try to join up adjacent columns to make a larger
917 // lower and upper bounds
918 int l = (d < 0) ? 1 : 0;
919 int u = (d > 0) ? 1 : 0;
921 if (jselection.getStartRes() > 0
922 && prange[p + l] == jselection.getStartRes())
924 jselection.setStartRes(prange[p + l] - 1);
926 if (jselection.getEndRes() <= maxWidth
927 && prange[p + u] == (jselection.getEndRes() + 2))
929 jselection.setEndRes(prange[p + u] - 1);
931 // mark all the columns in the range.
932 for (int sr = prange[p], er = prange[p + 1], de = er
933 + d; sr != de; sr += d)
935 colsel.addElement(sr - 1);
944 ssm.sendSelection(jselection, colsel, me);
947 for (int c = 0; c < jvobjs.length; c++)
957 picker = new VamsasListener()
959 SequenceI last = null;
963 public void mouseOver(SequenceI seq, int index,
968 if (seq != last || i != index)
970 VorbaId v = (VorbaId) jv2vobj.get(seq);
973 // this should really be a trace message.
974 // Cache.log.debug("Mouse over " + v.getId() + " bound to "
975 // + seq + " at " + index);
978 MouseOverMessage message = new MouseOverMessage(v.getId(),
980 pm.sendMessage(message);
985 selecter = new SelectionListener()
988 public void selection(SequenceGroup seqsel,
989 ColumnSelection colsel, SelectionSource source)
994 .warn("Selection listener still active for dead session.");
1000 AlignmentI visal = null;
1001 if (source instanceof AlignViewport)
1003 visal = ((AlignViewport) source).getAlignment();
1005 SelectionMessage sm = null;
1006 if ((seqsel == null || seqsel.getSize() == 0)
1007 && (colsel == null || colsel.getSelected() == null || colsel
1008 .getSelected().size() == 0))
1010 if (source instanceof AlignViewport)
1012 // the empty selection.
1013 sm = new SelectionMessage("jalview", new String[]
1014 { ((AlignViewport) source).getSequenceSetId() }, null,
1019 // the empty selection.
1020 sm = new SelectionMessage("jalview", null, null, true);
1025 String[] vobj = new String[seqsel.getSize()];
1027 for (SequenceI sel : seqsel.getSequences(null))
1029 VorbaId v = (VorbaId) jv2vobj.get(sel);
1032 vobj[o++] = v.toString();
1035 if (o < vobj.length)
1038 vobj = new String[o];
1039 System.arraycopy(t, 0, vobj, 0, o);
1043 if (seqsel != null && colsel != null)
1045 // deparse the colsel into positions on the vamsas alignment
1047 range = new Input();
1048 if (colsel.getSelected() != null
1049 && colsel.getSelected().size() > 0
1051 && seqsel.getSize() == visal.getHeight())
1053 // gather selected columns outwith the sequence positions
1055 Enumeration cols = colsel.getSelected().elements();
1056 while (cols.hasMoreElements())
1058 int ival = ((Integer) cols.nextElement()).intValue();
1066 int[] intervals = colsel.getVisibleContigs(
1067 seqsel.getStartRes(), seqsel.getEndRes() + 1);
1068 for (int iv = 0; iv < intervals.length; iv += 2)
1071 s.setStart(intervals[iv] + 1); // vamsas indices begin at
1073 s.setEnd(intervals[iv + 1] + 1);
1074 s.setInclusive(true);
1079 if (vobj.length > 0)
1081 sm = new SelectionMessage("jalview", vobj, range);
1090 sm.validate(); // debug
1091 Cache.log.debug("Selection Message\n" + sm.getRawMessage());
1098 ssm.addStructureViewerListener(picker); // better method here
1099 ssm.addSelectionListener(selecter);
1100 } catch (Exception e)
1102 Cache.log.error("Failed to init Vamsas Picking", e);
1107 public String getCurrentSession()
1109 if (vclient != null)
1111 return (vclient.getSessionUrn());