2 * This file is part of the Vamsas Client version 0.2.
3 * Copyright 2010 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 * flag indicating if unresolved references should be raised during UnMarshalling
52 protected boolean warnUnresolved;
55 * construct a new id appropriate for this client in the vamsas session.
57 * @return valid VorbaId for session, or null if VorbaIdFactory not configured
60 public abstract VorbaId makeVorbaId(Vobject vobject);
63 * internal method to access the protected VorbaId object constructor This
64 * shennanigan is to prevent casual generation of VorbaIds (which may destroy
65 * the integrity of a Vamsas Document!)
68 * @return new VorbaId object
70 protected VorbaId newId(String id) {
71 return VorbaId.newId(id);
75 * Called by VorbaXmlBinder so the record of newly unmarshalled Vobject Ids is
76 * accessible to the Document's VorbaIdFactory instance.
80 protected void setNewIdHash(Hashtable idtable) {
88 * uk.ac.vamsas.client.IVorbaIdFactory#updateHashValue(uk.ac.vamsas.client
91 public void updateHashValue(Vobject vobject) {
92 if (vobject.isRegisterable())
93 extanthashv.put(vobject.getVorbaId(), new Vobjhash(vobject));
97 * TODO: decide if these are needed.
99 * @param sessionHandle
101 protected abstract void setSession(SessionHandle sessionhandle);
103 public abstract SessionHandle getSessionHandle();
105 protected abstract void setClient(ClientHandle appHandle);
107 public abstract ClientHandle getClientHandle();
109 protected abstract void setUser(UserHandle userHandle);
111 public abstract UserHandle getUserHandle();