applied LGPLv3 and source code formatting.
[vamsas.git] / src / uk / ac / vamsas / objects / IVorbaBinding.java
1 /*\r
2  * This file is part of the Vamsas Client version 0.1. \r
3  * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
4  *  Andrew Waterhouse and Dominik Lindner.\r
5  * \r
6  * Earlier versions have also been incorporated into Jalview version 2.4 \r
7  * since 2008, and TOPALi version 2 since 2007.\r
8  * \r
9  * The Vamsas Client is free software: you can redistribute it and/or modify\r
10  * it under the terms of the GNU Lesser General Public License as published by\r
11  * the Free Software Foundation, either version 3 of the License, or\r
12  * (at your option) any later version.\r
13  *  \r
14  * The Vamsas Client is distributed in the hope that it will be useful,\r
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  * GNU Lesser General Public License for more details.\r
18  * \r
19  * You should have received a copy of the GNU Lesser General Public License\r
20  * along with the Vamsas Client.  If not, see <http://www.gnu.org/licenses/>.\r
21  */\r
22 package uk.ac.vamsas.objects;\r
23 \r
24 import uk.ac.vamsas.client.Vobject;\r
25 import uk.ac.vamsas.client.VorbaId;\r
26 \r
27 /**\r
28  * Provides methods to map between VorbaIds and arbitrary object references for\r
29  * use by a vamsas Application when moving between its own datamodel and the\r
30  * Vamsas session objects. The implementing class needs a valid client-document\r
31  * instance if it is expected to be able to register newly created vObjects.\r
32  * Normally this will be the case if the implementing class has been generated\r
33  * by an IClient implementation which will also have passed it a reference to\r
34  * the current valid IClientDocument instance for that application's document\r
35  * access thread. TODO: add remove/clear binding functions - currently you can\r
36  * just pass a null to either argument for bindAppsObjectToVamsasObject to\r
37  * remove the binding from memory.\r
38  * \r
39  * @author JimP\r
40  * \r
41  */\r
42 public interface IVorbaBinding {\r
43   /**\r
44    * get the Vamsas session object bound to an internal object.\r
45    * \r
46    * @param appObject\r
47    * @return valid session object or Null.\r
48    */\r
49   Vobject getVamsasObjectFor(Object appObject);\r
50 \r
51   /**\r
52    * Get the Application's own object bound to an existing Vamsas session object\r
53    * \r
54    * @param vObject\r
55    *          - object in vamsas document\r
56    * @return apps object bound to the vamsas document object\r
57    */\r
58   Object getAppsObjectFor(uk.ac.vamsas.client.Vobject vObject);\r
59 \r
60   /**\r
61    * Record a mapping between a vamsas document object and an application's\r
62    * internal object. If either appObject or vObject parameters are null then\r
63    * any existing binding to the non-null object will be deleted\r
64    * \r
65    * @param appObject\r
66    * @param vObject\r
67    *          - if newly created then it will be registered using the\r
68    *          uk.ac.vamsas.client.IClientDocument.registerObject method.\r
69    */\r
70   void bindAppsObjectToVamsasObject(Object appObject,\r
71       uk.ac.vamsas.client.Vobject vObject);\r
72 }\r