\r
public class JPredClient\r
{\r
-\r
- JInternalFrame outputFrame = new JInternalFrame();\r
- CutAndPasteTransfer output = new CutAndPasteTransfer(false);\r
int jobsRunning = 0;\r
ext.vamsas.JpredSoapBindingStub server;\r
+ WebserviceInfo wsInfo;\r
\r
public JPredClient(SequenceI[] msf)\r
{\r
- SequenceI seq = msf[0];\r
- output.formatForOutput();\r
- outputFrame.setContentPane(output);\r
+ wsInfo = new WebserviceInfo("JNet secondary structure prediction job",\r
+ "\"Cuff J. A and Barton G.J (1999) Application of enhanced multiple sequence alignment profiles to improve protein secondary structure prediction, Proteins 40:502-511\".");\r
\r
- output.setText("Job details for MSA based prediction on sequence :\nName : "\r
+ SequenceI seq = msf[0];\r
+ wsInfo.setProgressText("Job details for MSA based prediction on sequence :\nName : "\r
+ seq.getName() + "\nSequence : "\r
+ AlignSeq.extractGaps("-. ",seq.getSequence()) + "\n");\r
- Desktop.addInternalFrame(outputFrame,\r
- "JNet secondary structure prediction job", 800,\r
- 300);\r
+\r
\r
JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
try {\r
this.server = (JpredSoapBindingStub) loc.getjpred(); // JBPNote will be set from properties\r
}\r
catch (Exception ex) {\r
- output.setText("Serious! JPred Service location failed\nfor URL :"\r
+ wsInfo.setProgressText("Serious! JPred Service location failed\nfor URL :"\r
+loc.getjpredAddress()+"\n"+ex.getMessage());\r
}\r
\r
JPredThread jthread = new JPredThread(msf);\r
jthread.start();\r
- ImageTwirler thread = new ImageTwirler();\r
- thread.start();\r
}\r
\r
public JPredClient(SequenceI seq)\r
{\r
- output.formatForOutput();\r
- outputFrame.setContentPane(output);\r
+ wsInfo = new WebserviceInfo("JNet secondary structure prediction job",\r
+ "\"Cuff J. A and Barton G.J (1999) Application of enhanced multiple sequence alignment profiles to improve protein secondary structure prediction, Proteins 40:502-511\".");\r
\r
- output.setText("Job details for prediction on sequence :\nName : "\r
+\r
+ wsInfo.setProgressText("Job details for prediction on sequence :\nName : "\r
+ seq.getName() + "\nSequence : " + AlignSeq.extractGaps("-. ",seq.getSequence()) + "\n");\r
- Desktop.addInternalFrame(outputFrame,\r
- "JNet secondary structure prediction job", 800,\r
- 300);\r
\r
JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
try {\r
this.server = (JpredSoapBindingStub) loc.getjpred(); // JBPNote will be set from properties\r
}\r
catch (Exception ex) {\r
- output.setText("Serious! JPred Service location failed\nfor URL :"\r
+ wsInfo.setProgressText("Serious! JPred Service location failed\nfor URL :"\r
+loc.getjpredAddress()+"\n"+ex.getMessage());\r
}\r
\r
JPredThread jthread = new JPredThread(seq);\r
jthread.start();\r
- ImageTwirler thread = new ImageTwirler();\r
- thread.start();\r
}\r
\r
- class ImageTwirler\r
- extends Thread\r
- {\r
- ImageIcon[] imageIcon;\r
- int imageIndex = 0;\r
- public ImageTwirler()\r
- {\r
- imageIcon = new ImageIcon[9];\r
- for (int i = 0; i < 9; i++)\r
- {\r
- java.net.URL url = getClass().getResource("/images/dna" + (i + 1) +\r
- ".gif");\r
- if (url != null)\r
- imageIcon[i] = new ImageIcon(url);\r
- }\r
- }\r
-\r
- public void run()\r
- {\r
- while (jobsRunning > 0)\r
- {\r
- try\r
- {\r
- Thread.sleep(100);\r
- imageIndex++;\r
- imageIndex %= 9;\r
- outputFrame.setFrameIcon(imageIcon[imageIndex]);\r
- outputFrame.setTitle("JNet Secondary Structure Prediction : " +\r
- jobsRunning + " jobs running.");\r
-\r
- }\r
- catch (Exception ex)\r
- {}\r
-\r
- }\r
- }\r
- }\r
\r
class JPredThread\r
extends Thread\r
int allowedServerExceptions = 3; // thread dies if too many exceptions.\r
JPredThread(SequenceI seq)\r
{\r
- OutputHeader = output.getText();\r
+ OutputHeader = wsInfo.getProgressText();\r
this.sequence = new ext.vamsas.Sequence();\r
this.sequence.setId(seq.getName());\r
this.sequence.setSeq(AlignSeq.extractGaps("-. ",seq.getSequence()));\r
\r
JPredThread(SequenceI[] msf)\r
{\r
- OutputHeader = output.getText();\r
+ OutputHeader = wsInfo.getProgressText();\r
this.sequence = new ext.vamsas.Sequence();\r
this.sequence.setId(msf[0].getName());\r
this.sequence.setSeq(AlignSeq.extractGaps("-. ",msf[0].getSequence()));\r
\r
StartJob();\r
\r
- while (!jobComplete\r
- && (allowedServerExceptions > 0))\r
+ while (!jobComplete && (allowedServerExceptions > 0))\r
{\r
try\r
{\r
result = server.getresult(jobId);\r
\r
+ if( result.isRunning() )\r
+ wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
+ else if( result.isQueued() )\r
+ wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
+\r
if (result.isFinished())\r
{\r
parseResult();\r
}\r
else\r
{\r
- output.setText(OutputHeader + "\n" + result.getStatus());\r
+ wsInfo.setProgressText(OutputHeader + "\n" + result.getStatus());\r
if (! (result.isJobFailed() || result.isServerError()))\r
{\r
Thread.sleep(5000);\r
- // System.out.println("I'm alive "+seqid+" "+jobid);\r
+ // System.out.println("I'm alive "+seqid+" "+jobid);\r
}\r
}\r
}\r
catch (Exception ex)\r
{\r
allowedServerExceptions--;\r
- String msg = output.getText();\r
- output.setText(msg + "\nJPredWS Server exception!\n" + ex.getMessage());\r
+ wsInfo.appendProgressText("\nJPredWS Server exception!\n" + ex.getMessage());\r
}\r
}\r
+\r
+ if (! (result.isJobFailed() || result.isServerError()))\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
+ else\r
+ wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
}\r
\r
void StartJob()\r
if (result.getAligfile()!=null) {\r
OutputHeader += "\n"+result.getAligfile();\r
}\r
- output.setText(OutputHeader);\r
+ wsInfo.setProgressText(OutputHeader);\r
try {\r
// JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", "File");\r
jalview.io.JPredFile prediction = new jalview.io.JPredFile(result.getPredfile(), "Paste");\r