Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2867 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: lookingglass ui/actions

Subject: perfsonar development work

List archive

perfsonar: r2867 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: lookingglass ui/actions


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2867 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: lookingglass ui/actions
  • Date: Tue, 25 Sep 2007 12:38:34 -0400

Author: nina
Date: 2007-09-25 12:38:34 -0400 (Tue, 25 Sep 2007)
New Revision: 2867

Modified:

branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/MetadataRequestAction.java
Log:
a very basic skeleton for Looking glass plugin

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
2007-09-25 15:59:06 UTC (rev 2866)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/lookingglass/LGRequest.java
2007-09-25 16:38:34 UTC (rev 2867)
@@ -24,6 +24,9 @@

package org.perfsonar.perfsonarui.lookingglass;

+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
import org.perfsonar.perfsonarui.AbstractMARequest;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.IPerfsonarResponse;
@@ -31,6 +34,7 @@
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;

public class LGRequest extends AbstractMARequest {

@@ -41,9 +45,39 @@
public Document createRequest(IUserData uData, String messageType)
throws Exception {
Document doc = null;
- System.out.println(uData.getQuery("param1"));
+
if
(IPerfsonarRequest.MA_MetadataKeyRequest.equals(messageType)) {

+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ doc = builder.newDocument();
+
+ Element msg = doc.createElementNS(NMWG2,"nmwg:message");
+ msg.setAttribute("id", "msg1");
+ msg.setAttribute("type", messageType);
+
+ doc.appendChild(msg);
+
+ Element metadata =
doc.createElementNS(NMWG2,"nmwg:metadata");
+ metadata.setAttribute("id", "meta1");
+ msg.appendChild(metadata);
+
+ Element subject = doc.createElementNS(NMWG2,"nmwg:subject");
+ subject.setAttribute("id", "server");
+ metadata.appendChild(subject);
+
+ Element params =
doc.createElementNS(NMWG2,"nmwg:parameters");
+ params.setAttribute("id", "params1");
+ subject.appendChild(params);
+
+ Element param = doc.createElementNS(NMWG2,"nmwg:parameter");
+ param.setAttribute("id", "param1");
+ params.appendChild(param);
+
+ //here comes the data entered in by the user
+
param.appendChild(doc.createTextNode(uData.getQuery("param1")));
+
//create the relevant Document, get parameters from
udata
/*
<?xml version='1.0' encoding='UTF-8'?>

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/MetadataRequestAction.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/MetadataRequestAction.java
2007-09-25 15:59:06 UTC (rev 2866)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/actions/MetadataRequestAction.java
2007-09-25 16:38:34 UTC (rev 2867)
@@ -25,17 +25,23 @@
package org.perfsonar.perfsonarui.ui.actions;

import java.awt.event.ActionEvent;
+import java.util.Date;

import javax.swing.Icon;
import javax.swing.JOptionPane;

import org.perfsonar.perfsonarui.MetadataListResponseListener;
+import org.perfsonar.perfsonarui.PerfsonarResponseEvent;
import org.perfsonar.perfsonarui.SmartMARequest;
+import org.perfsonar.perfsonarui.ippm.IPPMMetaDataList;
+import org.perfsonar.perfsonarui.ippm.IPPMUserData;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.IUserData;
+import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
+import org.w3c.dom.Document;

/**
*
@@ -74,11 +80,76 @@
public void run(ActionEvent arg0) {
if (request == null) return;
try {
- request.makeRequest(null,null,
IPerfsonarRequest.MA_MetadataKeyRequest, new
MetadataListResponseListener(dataList), false);
+ enableActions(true);
+
+ dataList.clear();
+ dataList.setNotificationEnabled(false);
+
+ //datePanel = null;
+ enableActions(false);
+ //endpointsPanel = null;
+
+
+ boolean ok = false;
+ for (int i=0; i < endpoints.size();i++) {
+ if (isInterrupted()) break;
+ MAEndpoint mae = endpoints.get(i);
+ if (mae.isEnabled()) {
+ ok = true;
+
dataList.setNotificationEnabled(false);
+ userData.setEndpoint(mae);
+ request.fireStatusMessage("Retrieving
metadata from " + userData.getEndpoint());
+ try {
+ MetadataListResponseListener
listener = new MetadataListResponseListener(dataList) {
+ @Override
+ public synchronized
void callException(PerfsonarResponseEvent e) {
+
super.callException(e);
+
getDataList().clear();
+ logger.error(e.getException());
+
handleException(e.getException(),userData.getEndpoint());
+
getDataList().setSelectedItem(null);
+
//request.removePropertyChangeListener(this);
+ }
+ @Override
+ public synchronized
void callCompleted(IPerfsonarRequest request) {
+
super.callCompleted(request);
+
//request.removePropertyChangeListener(this);
+ }
+ @Override
+ public void
process(IPerfsonarRequest request, IUserData uData, Document response) throws
Exception {
+
super.process(request, uData, response);
+
getDataList().setSelectedItem(null);
+ }
+ @Override
+ public synchronized
void processingCompleted(IPerfsonarRequest request) {
+
super.processingCompleted(request);
+
getDataList().setSelectedItem(null);
+ }
+
+ };
+ request.makeRequest(
userData, IPerfsonarRequest.MA_MetadataKeyRequest, listener, false);
+ mae.setStatus("OK");
+
mae.setStatusExplanation("OK");
+ mae.setAlive(true );
+
+ break;
+
//PerfsonarResponseEvent.COMMAND_CALLEXCEPTION
+
//request.addPropertyChangeListener(PerfsonarResponseEvent);
+ } catch (Exception x) {
+ logger.error(x);
+ handleException(x,mae);
+ }
+
+ }
+ }
+
if (request instanceof SmartMARequest)
((SmartMARequest) request).isReady();
+
+ dataList.setNotificationEnabled(true);
+ if (!ok) JOptionPane.showMessageDialog(frame,"No IPPM
service selected!","Error",JOptionPane.ERROR_MESSAGE);
} catch (Exception x) {
-
JOptionPane.showMessageDialog(null,x,"Error",JOptionPane.ERROR_MESSAGE);
+
JOptionPane.showMessageDialog(frame,x,"Error",JOptionPane.ERROR_MESSAGE);
logger.error(x);
}
}
@@ -100,4 +171,15 @@
public synchronized void setEndpoints(MAEndpointList endpoints) {
this.endpoints = endpoints;
}
+ protected void handleException(Exception x, MAEndpoint endpoint) {
+ endpoint.setStatus(x.getMessage());
+ endpoint.setStatusExplanation(x);
+ endpoint.setAlive(false);
+ if (JOptionPane.showConfirmDialog(frame,
+ x.getMessage() + "\nContinue querying service "+
endpoint.getTitle() + "?"
+ ,"Please confirm",
+
JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) ==
JOptionPane.NO_OPTION)
+ if (endpoint != null)
+ endpoint.setEnabled(false);
+ }
}



  • perfsonar: r2867 - in branches/perfsonarui/src/org/perfsonar/perfsonarui: lookingglass ui/actions, svnlog, 09/25/2007

Archive powered by MHonArc 2.6.16.

Top of Page