Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 10:11:34 GMT
  2. Package jalview.ws.jws1

File WS1Client.java

 

Coverage histogram

../../../img/srcFileCovDistChart3.png
52% of files have more coverage

Code metrics

6
15
4
1
134
53
7
0.47
3.75
4
1.75

Classes

Class Line # Actions
WS1Client 39 15 7
0.2424%
 

Contributing tests

This file is covered by 180 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.ws.jws1;
22   
23    import jalview.gui.AlignFrame;
24    import jalview.gui.WebserviceInfo;
25    import jalview.util.MessageManager;
26    import jalview.ws.WSClient;
27    import jalview.ws.WSMenuEntryProviderI;
28   
29    import javax.swing.JMenu;
30   
31    import ext.vamsas.ServiceHandle;
32   
33    /**
34    * JWS1 Specific UI attributes and methods
35    *
36    * @author JimP
37    *
38    */
 
39    public abstract class WS1Client extends WSClient
40    implements WSMenuEntryProviderI
41    {
42   
43    /**
44    * original service handle that this client was derived from
45    */
46    ServiceHandle serviceHandle = null;
47   
48    /**
49    * default constructor
50    */
 
51  18 toggle public WS1Client()
52    {
53  18 super();
54    }
55   
56    /**
57    * initialise WSClient service information attributes from the service handle
58    *
59    * @param sh
60    * @return the service instance information GUI for this client and job.
61    */
 
62  0 toggle protected WebserviceInfo setWebService(ServiceHandle sh)
63    {
64  0 return setWebService(sh, false);
65    }
66   
67    /**
68    * initialise WSClient service information attributes from the service handle
69    *
70    * @param sh
71    * @param headless
72    * true implies no GUI objects will be created.
73    * @return the service instance information GUI for this client and job.
74    */
 
75  0 toggle protected WebserviceInfo setWebService(ServiceHandle sh, boolean headless)
76    {
77  0 WebServiceName = sh.getName();
78  0 if (ServiceActions.containsKey(sh.getAbstractName()))
79    {
80  0 WebServiceJobTitle = sh.getName(); // TODO: control sh.Name specification
81    // properly
82    // add this for short names. +(String)
83    // ServiceActions.get(sh.getAbstractName());
84    }
85    else
86    {
87  0 WebServiceJobTitle = sh.getAbstractName() + " using " + sh.getName();
88   
89    }
90  0 WebServiceReference = sh.getDescription();
91  0 WsURL = sh.getEndpointURL();
92  0 WebserviceInfo wsInfo = null;
93  0 if (!headless)
94    {
95  0 wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference,
96    true);
97    }
98  0 return wsInfo;
99    }
100   
101    /**
102    * convenience method to pass the serviceHandle reference that instantiated
103    * this service on to the menu entry constructor
104    *
105    * @param wsmenu
106    * the menu to which any menu entries/sub menus are to be attached
107    * @param alignFrame
108    * the alignFrame instance that provides input data for the service
109    */
 
110  3396 toggle public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame)
111    {
112  3396 if (serviceHandle == null)
113    {
114  0 throw new Error(MessageManager.getString(
115    "error.implementation_error_cannot_attach_ws_menu_entry"));
116    }
117  3396 attachWSMenuEntry(wsmenu, serviceHandle, alignFrame);
118    }
119   
120    /**
121    * method implemented by each concrete WS1Client implementation that creates
122    * menu entries that enact their service using data from alignFrame.
123    *
124    * @param wsmenu
125    * where new menu entries (and submenus) are to be attached
126    * @param serviceHandle
127    * the serviceHandle document for the service that entries are
128    * created for
129    * @param alignFrame
130    */
131    public abstract void attachWSMenuEntry(JMenu wsmenu,
132    final ServiceHandle serviceHandle, final AlignFrame alignFrame);
133   
134    }