2 * This file is part of the Vamsas Client version 0.1.
3 * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite,
4 * Andrew Waterhouse and Dominik Lindner.
6 * Earlier versions have also been incorporated into Jalview version 2.4
7 * since 2008, and TOPALi version 2 since 2007.
9 * The Vamsas Client is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * The Vamsas Client is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
22 package uk.ac.vamsas.client;
24 import java.util.Hashtable;
25 import java.util.Vector;
28 * A VorbaIdFactory is constructed by an IClient instance. It guarantees that
29 * any new VorbaId objects are unique within the VAMSAS session.
33 public abstract class VorbaIdFactory implements IVorbaIdFactory {
35 * hash of VorbaIds to Vobject.
37 protected Hashtable extantids = null;
40 * hash of VorbaIds to persisted hash values
42 protected Hashtable extanthashv = null;
45 * list of Vobjects added since last Document read.
47 protected Vector newobj = null;
50 * construct a new id appropriate for this client in the vamsas session.
52 * @return valid VorbaId for session, or null if VorbaIdFactory not configured
55 public abstract VorbaId makeVorbaId(Vobject vobject);
58 * internal method to access the protected VorbaId object constructor This
59 * shennanigan is to prevent casual generation of VorbaIds (which may destroy
60 * the integrity of a Vamsas Document!)
63 * @return new VorbaId object
65 protected VorbaId newId(String id) {
66 return VorbaId.newId(id);
70 * Called by VorbaXmlBinder so the record of newly unmarshalled Vobject Ids is
71 * accessible to the Document's VorbaIdFactory instance.
75 protected void setNewIdHash(Hashtable idtable) {
83 * uk.ac.vamsas.client.IVorbaIdFactory#updateHashValue(uk.ac.vamsas.client
86 public void updateHashValue(Vobject vobject) {
87 if (vobject.isRegisterable())
88 extanthashv.put(vobject.getVorbaId(), new Vobjhash(vobject));
92 * TODO: decide if these are needed.
94 * @param sessionHandle
96 protected abstract void setSession(SessionHandle sessionhandle);
98 public abstract SessionHandle getSessionHandle();
100 protected abstract void setClient(ClientHandle appHandle);
102 public abstract ClientHandle getClientHandle();
104 protected abstract void setUser(UserHandle userHandle);
106 public abstract UserHandle getUserHandle();