argList = parmSet.getArguments();
parmSet = null;
}
- AAConSettings settings = new AAConSettings(
+ AutoCalcSetting settings = new AAConSettings(
calcIdParam.isAutoUpdate(), service, parmSet, argList);
av.setCalcIdSettingsFor(calcIdParam.getCalcId(), settings,
calcIdParam.isNeedsUpdate());
import jalview.gui.AlignFrame;
import jalview.gui.JvSwingUtils;
import jalview.util.MessageManager;
+import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.dm.AAConSettings;
-import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.AutoCalcSetting;
import jalview.ws.uimodel.AlignAnalysisUIText;
import java.awt.event.ActionEvent;
public class Jws2ClientFactory
{
static boolean registerAAConWSInstance(final JMenu wsmenu,
- final Jws2Instance service, final AlignFrame alignFrame)
+ final ServiceWithParameters service, final AlignFrame alignFrame)
{
final AlignAnalysisUIText aaui = service.getAlignAnalysisUI(); // null
// ; //
* AACon server to use What parameters to use
*/
// could actually do a class search for this too
- AAConSettings fave = (AAConSettings) alignFrame.getViewport()
+ AutoCalcSetting fave = alignFrame.getViewport()
.getCalcIdSettingsFor(aaui.getCalcId());
if (fave == null)
{
private static void buildCurrentAAConWorkerFor(
final AlignAnalysisUIText aaui, AlignFrame alignFrame,
- Jws2Instance service)
+ ServiceWithParameters service)
{
/*
* preferred settings Whether AACon is automatically recalculated Which
* AACon server to use What parameters to use
*/
- AAConSettings fave = (AAConSettings) alignFrame.getViewport()
+ AutoCalcSetting fave = alignFrame.getViewport()
.getCalcIdSettingsFor(aaui.getCalcId());
if (fave == null)
{
new SequenceAnnotationWSClient(fave, alignFrame, false);
}
- private static AAConSettings createDefaultAAConSettings(
+ private static AutoCalcSetting createDefaultAAConSettings(
AlignAnalysisUIText aaui)
{
return createDefaultAAConSettings(aaui, null);
}
- private static AAConSettings createDefaultAAConSettings(
- AlignAnalysisUIText aaui, Jws2Instance service)
+ private static AutoCalcSetting createDefaultAAConSettings(
+ AlignAnalysisUIText aaui, ServiceWithParameters service)
{
if (service != null)
{
import jalview.gui.JvSwingUtils;
import jalview.util.MessageManager;
import jalview.ws.api.ServiceWithParameters;
-import jalview.ws.jws2.dm.AAConSettings;
-import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.AutoCalcSetting;
import jalview.ws.params.WsParamSetI;
import jalview.ws.uimodel.AlignAnalysisUIText;
}
}
- public SequenceAnnotationWSClient(AAConSettings fave,
+ public SequenceAnnotationWSClient(AutoCalcSetting fave,
AlignFrame alignFrame, boolean b)
{
super(alignFrame, fave.getPreset(), fave.getArgumentSet());
final ServiceWithParameters service,
final AlignFrame alignFrame)
{
- if (service instanceof Jws2Instance
- && Jws2ClientFactory.registerAAConWSInstance(wsmenu, (Jws2Instance) service, alignFrame))
+ if (Jws2ClientFactory.registerAAConWSInstance(wsmenu,
+ service, alignFrame))
{
// Alignment dependent analysis calculation WS gui
return;
*/
package jalview.ws.jws2.dm;
-import jalview.util.MessageManager;
import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.JabaParamStore;
-import jalview.ws.jws2.JabaPreset;
import jalview.ws.jws2.ParameterUtils;
-import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.WsParamSetI;
-import java.util.ArrayList;
import java.util.List;
-import compbio.metadata.Argument;
import compbio.metadata.Option;
/**
*/
public class AAConSettings extends jalview.ws.params.AutoCalcSetting
{
- ServiceWithParameters service;
-
public AAConSettings(boolean autoUpdate, ServiceWithParameters service2,
WsParamSetI preset, List<ArgumentI> jobArgset)
{
- super(preset, jobArgset, autoUpdate);
- this.service = service2;
- }
-
- public ServiceWithParameters getService()
- {
- return service;
- }
-
- public void setService(Jws2Instance service)
- {
- this.service = service;
- if (preset != null)
- {
- // migrate preset to new service
- for (String url : preset.getApplicableUrls())
- {
- if (url.equals(service.getUri()))
- {
- return;
- }
- }
- WsParamSetI pr = service.getParamStore().getPreset(preset.getName());
- if (pr instanceof JabaPreset && preset instanceof JabaPreset)
- {
- // easy - Presets are identical (we assume)
- preset = pr;
- return;
- }
- List<ArgumentI> oldargs = new ArrayList<>(),
- newargs = new ArrayList<>();
- oldargs.addAll(preset.getArguments());
- // need to compare parameters
- for (ArgumentI newparg : pr.getArguments())
- {
- if (!oldargs.remove(newparg))
- {
- newargs.add(newparg);
- }
- }
- if (oldargs.size() == 0 && newargs.size() == 0)
- {
- // exact match.
- preset = pr;
- return;
- }
- // Try even harder to migrate arguments.
- throw new Error(MessageManager
- .getString("error.parameter_migration_not_implemented_yet"));
- }
- }
-
- public List<Argument> getJobArgset()
- {
- return jobArgset == null ? null
- : JabaParamStore.getJabafromJwsArgs(jobArgset);
- }
-
- public void setJobArgset(List<Argument> jobArgset)
- {
- // TODO: test if parameters valid for service
- this.jobArgset = jobArgset == null ? null
- : JabaParamStore.getJwsArgsfromJaba(jobArgset);
+ super(service2, preset, jobArgset, autoUpdate);
}
@Override
}
return pset.toString();
}
-
- @Override
- public String getServiceURI()
- {
- return service.getNameURI();
- }
-
- @Override
- public String[] getServiceURLs()
- {
- return new String[] { service.getUri() };
- }
}
*/
package jalview.ws.params;
+import jalview.util.MessageManager;
+import jalview.ws.api.ServiceWithParameters;
+
+import java.util.ArrayList;
import java.util.List;
public abstract class AutoCalcSetting
protected List<ArgumentI> jobArgset;
- public AutoCalcSetting(WsParamSetI preset2, List<ArgumentI> jobArgset2,
+ protected ServiceWithParameters service;
+
+ public AutoCalcSetting(ServiceWithParameters service2,
+ WsParamSetI preset2, List<ArgumentI> jobArgset2,
boolean autoUpdate2)
{
+ service = service2;
autoUpdate = autoUpdate2;
preset = preset2;
jobArgset = jobArgset2;
}
/**
+ * TODO: refactor to ServiceWithParameters ?
*
* @return characteristic URI for this service. The URI should reflect the
* type and version of this service, enabling the service client code
* to recover the correct client for this calculation.
*/
- public abstract String getServiceURI();
+ public String getServiceURI()
+ {
+ return service.getNameURI();
+ }
/**
+ * TODO: refactor to ServiceWithParameters ?
+ *
* return any concrete service endpoints associated with this calculation.
* built in services should return a zero length array
*
* @return
*/
- public abstract String[] getServiceURLs();
+ public String[] getServiceURLs()
+ {
+ return new String[] { service.getUri() };
+ }
/**
*
*/
public abstract String getWsParamFile();
+ public ServiceWithParameters getService()
+ {
+ return service;
+ }
+
+ public void setService(ServiceWithParameters service)
+ {
+ this.service = service;
+ if (preset != null)
+ {
+ // check if we need to migrate preset to a new service URL
+ for (String url : preset.getApplicableUrls())
+ {
+ if (url.equals(service.getUri()))
+ {
+ // preset already verified
+ return;
+ }
+ }
+ WsParamSetI pr = service.getParamStore().getPreset(preset.getName());
+
+ // TODO: decide of this distinction between preset and args are needed.
+ //
+ // if (pr instanceof JabaPreset && preset instanceof JabaPreset)
+ // {
+ // // easy - Presets are identical (we assume)
+ // preset = pr;
+ // return;
+ // }
+
+ // this verifies that all arguments in the existing preset are the same as
+ // the parameters for the preset provided by the service parameter store.
+ // ie the LastUsed settings or a predefined preset.
+
+ List<ArgumentI> oldargs = new ArrayList<>(),
+ newargs = new ArrayList<>();
+ oldargs.addAll(preset.getArguments());
+ // need to compare parameters
+ for (ArgumentI newparg : pr.getArguments())
+ {
+ if (!oldargs.remove(newparg))
+ {
+ newargs.add(newparg);
+ }
+ }
+ if (oldargs.size() == 0 && newargs.size() == 0)
+ {
+ // exact match.
+ preset = pr;
+ return;
+ }
+ // Try even harder to migrate arguments.
+ throw new Error(MessageManager
+ .getString("error.parameter_migration_not_implemented_yet"));
+ }
+ }
+
}