geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [37/51] [partial] incubator-geode git commit: SGA #2
Date Fri, 03 Jul 2015 19:21:38 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ConnectToDS.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ConnectToDS.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ConnectToDS.java
new file mode 100644
index 0000000..1777471
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ConnectToDS.java
@@ -0,0 +1,378 @@
+/*=========================================================================
+ * (c)Copyright 2002-2011, GemStone Systems, Inc. All Rights Reserved.
+ * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006
+ * All Rights Reserved.
+ * =======================================================================*/
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.ConnectException;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+import com.gemstone.gemfire.LicenseException;
+import com.gemstone.gemfire.mgmt.DataBrowser.app.DataBrowserApp;
+import com.gemstone.gemfire.mgmt.DataBrowser.app.State;
+import com.gemstone.gemfire.mgmt.DataBrowser.connection.ConnectionFailureException;
+import com.gemstone.gemfire.mgmt.DataBrowser.connection.DSConfiguration;
+import com.gemstone.gemfire.mgmt.DataBrowser.connection.JMXOperationFailureException;
+import com.gemstone.gemfire.mgmt.DataBrowser.connection.VersionMismatchException;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.DSSnapShot;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.DataBrowserController;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.ConnectToDSDlg;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.CustomUIMessages;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.MainAppWindow;
+import com.gemstone.gemfire.mgmt.DataBrowser.utils.LogUtil;
+
+/**
+ * @author mghosh
+ *
+ */
+public final class ConnectToDS extends AbstractDataBrowserAction implements
+    IRunnableWithProgress {
+
+  static private final String iconEnabled = null;
+  static private final String iconDisabled = null;
+
+  /**
+   *
+   **/
+  public ConnectToDS() {
+    super();
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  public void run(IProgressMonitor arg0) throws InvocationTargetException,
+      InterruptedException {
+  }
+
+  // **********************************************************
+  //
+  // AbstractDataBrowserAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Connect to GemFire...";
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    // TODO Auto-generated method stub
+    return iconEnabled;
+  }
+
+
+
+  // **********************************************************
+  //
+  // IAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Connect to a GemFire distributed system";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Connects to the specified GemFire distributed system";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    boolean fRet = true;
+    if (null != app) {
+      DataBrowserController ctrlr = app.getController();
+      if (null != ctrlr) {
+        fRet = false == ctrlr.hasConnection();
+      }
+    }
+
+    return fRet;
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event event) {
+    Shell shl = null;
+    Display dsply = event.display;
+    if (null != dsply) {
+      shl = dsply.getActiveShell();
+    }
+
+    if (null == shl) {
+      Widget w = event.widget;
+      if (null != w) {
+        shl = w.getDisplay().getActiveShell();
+      }
+    }
+
+    ConnectToDSDlg dlg = new ConnectToDSDlg(shl);
+    ConnectToDSDlg.Data data = dlg.getData();
+
+    boolean fRetry = false;
+    String errMsg = null;
+    Throwable ex = null;
+    boolean fPromptForRetry = false;
+
+    do {
+      int iRetCode = dlg.open();
+      fRetry = false;
+      if (Window.OK == iRetCode) {
+        // TODO MGH - shl could be null here?
+        Shell shlDlg = dlg.getShell();
+        Control cursorControl = null;
+        if (null != shlDlg) {
+          Display dsplyDlg = shlDlg.getDisplay();
+          if (null != dsply) {
+            cursorControl = dsplyDlg.getCursorControl();
+            if (cursorControl != null) {
+              cursorControl.setCursor(new Cursor(dsply, SWT.CURSOR_WAIT));
+            }
+          }
+        }
+
+        DataBrowserController cntrlr = DataBrowserApp.getInstance()
+            .getController();
+        DSConfiguration cfg = new DSConfiguration();
+
+        data = dlg.getData();
+        cfg.setHost(data.host);
+        cfg.setPort(data.port);
+        cfg.setUserName(data.userName);
+        cfg.setPassword(data.password);
+        boolean fConnected = false;
+        try {
+          if (true == (fConnected = cntrlr.connect(cfg))) {
+            DSSnapShot dsss = cntrlr.getDSSnapShot();
+
+            DataBrowserApp app = DataBrowserApp.getInstance();
+            if (null != app) {
+              State st = app.getState();
+              st.addDS(dsss);
+              st.switchToDS(dsss);
+              MainAppWindow wnd = app.getMainWindow();
+              if (null != wnd) {
+                ArrayList<Object> prms = new ArrayList<Object>();
+                ArrayList<Object> res = new ArrayList<Object>();
+                prms.add(dsss);
+                wnd.sendCustomMessage(
+                    CustomUIMessages.DSTREE_MSG_UPDATE_SNAPSHOT, prms, res);
+                wnd.sendCustomMessage(CustomUIMessages.DS_CONNECTED, prms, res);
+              }
+            }
+            dsss = null;
+          }
+        }
+        // TODO MGH - need to clean this up as this exception is not thrown
+        /*
+         * catch (InvalidConfigurationException xptn) { errMsg =
+         * "GemFire DataBrowser - Connection Error";
+         * fPromptForRetry = true; }
+         */
+        catch (ConnectionFailureException xptn) {
+          errMsg = "An error occurred when attempting to connect to the GemFire Distributed System";
+          ex = xptn;
+          fPromptForRetry = xptn.isRetryAllowed();
+        } finally {
+          if (cursorControl != null)
+            if (!cursorControl.isDisposed())
+              cursorControl.setCursor(new Cursor(dsply, SWT.CURSOR_ARROW));
+        }
+
+        if (false == fConnected) {
+          // String[] hs = cfg.get;
+          // int[] ps = cfg.getPortList();
+          // StringBuffer dsInfo = new StringBuffer();
+          // if( true == cfg.isMcastEnabled() ) {
+          //              dsInfo.append( "Using MultiCast >> " );
+          //              dsInfo.append( hs[0] + ":" + ps[0] );
+          // }
+          // else {
+          // int itms = Math.min( hs.length, ps.length );
+          //
+          //              dsInfo.append( "Using Locators >>" );
+          // for( int i = 0; i < itms; i++ ) {
+          //                dsInfo.append( hs[0]+ ":" + ps[0] + "\n" );
+          // }
+          // }
+          //
+          //            errMsg = "Failed to connect to the GemFire Distributed System at " + dsInfo.toString();
+          // fPromptForRetry = true;
+        }
+
+        if (ex != null) {
+          LogUtil.error(errMsg, ex);
+          MessageBox mb = new MessageBox(shl, SWT.OK);
+          if (fPromptForRetry) {
+            mb = new MessageBox(shl, SWT.OK | SWT.CANCEL);
+          } else {
+            mb = new MessageBox(shl, SWT.OK);
+          }
+          mb.setText( "GemFire DataBrowser - Connection Error" );
+
+          StringBuilder builder = new StringBuilder();
+
+          if (ex instanceof VersionMismatchException) {
+            builder.append("Connection attempt to the GemFire Distributed System failed. Please verify that the DataBrowser is using same version of GemFire as the system you are connecting." );
+          } else  if(ex.getCause() instanceof SecurityException){
+              builder.append("Security is enabled on the JMX Manager. Valid credentials required");
+          } else {
+              builder.append(getExceptionDescription(ex, cfg, fPromptForRetry));
+          }
+          
+          mb.setMessage(builder.toString());
+          int iRetry = mb.open();
+          fRetry = fPromptForRetry && (SWT.OK == iRetry);
+          fPromptForRetry = false;
+          ex = null;
+        }
+      } // if( Window.OK = iRetCode )
+    } while (true == fRetry);
+
+  }
+  
+  public static boolean connect(DSConfiguration cfg){
+    DataBrowserController cntrlr = DataBrowserApp.getInstance()
+        .getController();
+    try {
+      if (cntrlr.connect(cfg)) {
+        DSSnapShot dsss = cntrlr.getDSSnapShot();
+
+        DataBrowserApp app = DataBrowserApp.getInstance();
+        if (null != app) {
+          State st = app.getState();
+          st.addDS(dsss);
+          st.switchToDS(dsss);
+          MainAppWindow wnd = app.getMainWindow();
+          if (null != wnd) {
+            ArrayList<Object> prms = new ArrayList<Object>();
+            ArrayList<Object> res = new ArrayList<Object>();
+            prms.add(dsss);
+            wnd.sendCustomMessage(
+                CustomUIMessages.DSTREE_MSG_UPDATE_SNAPSHOT, prms, res);
+            wnd.sendCustomMessage(CustomUIMessages.DS_CONNECTED, prms, res);
+          }
+        }
+        dsss = null;
+        return true;
+      }
+    }  catch (ConnectionFailureException e){
+      //no shell available not sure how to prompt user
+      LogUtil.error( "An error occurred when attempting to connect to the GemFire Distributed System", e);
+    }
+    return false;
+  }
+  
+  private String getExceptionDescription(Throwable ex, DSConfiguration cfg, boolean promptForRetry) {
+    StringBuffer buffer = new StringBuffer();
+    Throwable cause = ex.getCause();
+    
+    while(cause != null) {
+      if(cause instanceof ConnectException) {
+        buffer.append("Following error occurred when attempting to connect to the GemFire Distributed System.");
+        buffer.append("\n\nFailed to connect to the GemFire Locator/JMX Manager at ["+cfg.getHost()+":"+cfg.getPort()+"].");
+        buffer.append(" Please verify if the GemFire Locator/JMX Manager is running.");
+        if (promptForRetry) {
+          buffer.append("\n\nWould you like to reattempt connecting?");
+        }
+        return buffer.toString();        
+      
+      } else if(cause instanceof LicenseException) {
+        buffer.append("Following error occurred when attempting to connect to the GemFire Distributed System.");
+        buffer.append("\n\nLicense file \"gemfireLicense.zip\" does not exist in the current directory nor in the product directory.");
+        buffer.append("\nPlease provide a valid GemFire license in order to connect to the GemFire distributed system.");
+        if (promptForRetry) {
+          buffer.append("\n\nWould you like to reattempt connecting with new settings?");
+        }
+        return buffer.toString();
+      
+      } else if(cause instanceof JMXOperationFailureException) {
+        buffer.append("Following error occurred when attempting to connect to the GemFire Distributed System.");
+        buffer.append("\n\n");
+        buffer.append(cause.getMessage());
+        if (promptForRetry) {
+          buffer.append("\n\nWould you like to reattempt connecting?");
+        }
+        return buffer.toString();        
+      }
+      
+      cause = cause.getCause();      
+    }
+    
+    buffer.append("Following error occurred when attempting to connect to the GemFire Distributed System.");
+    buffer.append("\n\n");
+    buffer.append(ex.getMessage());
+    if (promptForRetry) {
+      buffer.append("\n\nWould you like to reattempt connecting with new settings?");
+    }
+    
+    return buffer.toString();
+  }
+   
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Copy.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Copy.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Copy.java
new file mode 100644
index 0000000..e74b524
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Copy.java
@@ -0,0 +1,137 @@
+/**
+ * 
+ */
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Event;
+
+/**
+ * @author mghosh
+ * 
+ */
+public class Copy extends AbstractDataBrowserAction implements
+    IRunnableWithProgress {
+
+  private static final String iconEnabled = null;
+  private static final String iconDisabled = null;
+
+  /**
+   * 
+   */
+  public Copy() {
+    // TODO Auto-generated constructor stub
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  public void run(IProgressMonitor monitor) throws InvocationTargetException,
+      InterruptedException {
+  }
+
+  // **********************************************************
+  //
+  // AbstractDataBrowserAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Copy";
+  }
+  
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    return iconEnabled;
+  }
+
+  // **********************************************************
+  //
+  // IAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Copies the current selection to the clipboard";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Copy the current selection to the clipboard";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    // TODO Auto-generated method stub
+    return super.isEnabled();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#run()
+   */
+  @Override
+  public void run() {
+    super.run();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event event) {
+    super.runWithEvent(event);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Cut.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Cut.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Cut.java
new file mode 100644
index 0000000..b4f96df
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Cut.java
@@ -0,0 +1,138 @@
+/**
+ *
+ */
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Event;
+
+/**
+ * @author mghosh
+ *
+ */
+public class Cut extends AbstractDataBrowserAction implements
+    IRunnableWithProgress {
+
+  private static final String iconEnabled = null;
+  private static final String iconDisabled = null;
+
+  /**
+   *
+   */
+  public Cut() {
+    // TODO Auto-generated constructor stub
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  public void run(IProgressMonitor monitor) throws InvocationTargetException,
+      InterruptedException {
+  }
+
+  // **********************************************************
+  //
+  // AbstractDataBrowserAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Cut";
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    return iconEnabled;
+  }
+
+
+
+  // **********************************************************
+  //
+  // IAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Cuts the current selection to the clipboard";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Cut the current selection to the clipboard";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    return super.isEnabled();
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#run()
+   */
+  @Override
+  public void run() {
+    super.run();
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event event) {
+    super.runWithEvent(event);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/DisconnectFromDS.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/DisconnectFromDS.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/DisconnectFromDS.java
new file mode 100644
index 0000000..3d9e317
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/DisconnectFromDS.java
@@ -0,0 +1,169 @@
+/**
+ *
+ */
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Event;
+
+import com.gemstone.gemfire.mgmt.DataBrowser.app.DataBrowserApp;
+import com.gemstone.gemfire.mgmt.DataBrowser.app.State;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.DSSnapShot;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.DataBrowserController;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.CustomUIMessages;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.MainAppWindow;
+
+/**
+ * @author mghosh
+ *
+ */
+public class DisconnectFromDS extends AbstractDataBrowserAction implements
+    IRunnableWithProgress {
+
+  static private final String iconEnabled = null;
+  static private final String iconDisabled = null;
+
+  /**
+	 *
+	 */
+  public DisconnectFromDS() {
+    super();
+  }
+
+  // *****************************************************************
+  //
+  // IAction stuff
+  //
+  // *****************************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Disconnect";
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    return iconEnabled;
+  }
+
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Disconnect from the currently connected GemFire distributed system";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Disconnect from the currently connected GemFire distributed system";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.IAction#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    /*
+     * State appState = DataBrowserApp.getInstance().getState(); return ((null
+     * != appState) && (null != appState.getCurrDS())) ? true : false;
+     */
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    boolean fRet = true;
+    if (null != app) {
+      DataBrowserController ctrlr = app.getController();
+      if (null != ctrlr) {
+        fRet = ctrlr.hasConnection();
+      }
+    }
+
+    return fRet;
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event
+   * )
+   */
+  @Override
+  public void runWithEvent(Event arg0) {
+    /*
+     * State appState = DataBrowserApp.getInstance().getState();
+     * DistributedSystem dsCurr = null; if ((null != appState) && (null !=
+     * (dsCurr = appState.getCurrDS()))) dsCurr.disconnect();
+     */
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    if (null != app) {
+      State st = app.getState();
+
+      DSSnapShot dsss = st.disconnect();
+      MainAppWindow wnd = app.getMainWindow();
+      if (null != wnd) {
+        ArrayList<Object> prms = new ArrayList<Object>();
+        ArrayList<Object> res = new ArrayList<Object>();
+        DSSnapShot currActiveDS = st.getCurrDS();
+        if( null != currActiveDS ) {
+          prms.add( st.getCurrDS() );
+        }
+        wnd.sendCustomMessage(CustomUIMessages.DSTREE_MSG_UPDATE_SNAPSHOT,
+            prms, res);
+        prms.clear();
+        prms.add( dsss );
+        wnd.sendCustomMessage(CustomUIMessages.DS_DISCONNECTED, prms, res);
+      }
+    }
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  public void run(IProgressMonitor arg0) throws InvocationTargetException,
+      InterruptedException {
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteCQuery.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteCQuery.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteCQuery.java
new file mode 100644
index 0000000..efcf460
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteCQuery.java
@@ -0,0 +1,460 @@
+/**
+ * 
+ */
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.window.ApplicationWindow;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+import com.gemstone.gemfire.cache.query.QueryInvalidException;
+import com.gemstone.gemfire.mgmt.DataBrowser.app.DataBrowserApp;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.CQConfiguarationPrms;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.DataBrowserController;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.ICQueryEventListener;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutedEvent;
+import com.gemstone.gemfire.mgmt.DataBrowser.model.member.GemFireMember;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.IntrospectionResult;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.cq.CQQuery;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.cq.event.ICQEvent;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.CqAppWindow;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.CustomUIMessages;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.MainAppWindow;
+
+/**
+ * @author mghosh
+ * 
+ */
+public class ExecuteCQuery extends ExecuteQuery {
+
+  private CqAppWindow parentWindow_;
+
+  private boolean isCqRunning = false;
+
+  private boolean isCqRegistered = true;
+
+  /**
+   * 
+   */
+  public ExecuteCQuery(CqAppWindow win) {
+    super();
+    parentWindow_ = win;
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  @Override
+  public void run(IProgressMonitor monitor) throws InvocationTargetException,
+      InterruptedException {
+    // TODO Auto-generated method stub
+
+  }
+
+  // **********************************************************
+  //
+  // AbstractDataBrowserAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    String text;
+    if (!isCqRunning)
+      text = "Execute Continuous Query";
+    else
+      text = "Stop Continuous Query";
+
+    return text;
+  }
+
+  // **********************************************************
+  //
+  // IAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Executes a GemFire Continuous Query on the selected member";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    if(this.isCqRunning) {
+      return "Stops the specified Continuous Query"; 
+    }
+    
+    return "Executes the specified Continuous Query on the selected member";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    return isCqRegistered;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#run()
+   */
+  @Override
+  public void run() {
+    runWithEvent(new Event());
+  }
+
+  private void cqRegistered(boolean registered) {
+    isCqRegistered = registered;
+    setEnabled(registered);
+  }
+
+  private void cqRunning(boolean running) {
+    isCqRunning = running;
+    if (running)
+      setText("Stop Continuous Query");
+    else
+      setText("Execute Continuous Query");
+  }
+  
+  @Override
+  protected ApplicationWindow getApplicationWindow() {
+    return this.parentWindow_;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event event1) {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    if (isCqRunning) {
+      app.getController().closeCq(parentWindow_.getId());
+      cqRunning(false);
+      cqRegistered(true);
+      return;
+    }
+    cqRunning(true);
+    cqRegistered(false);
+
+    // super.runWithEvent(event);
+   
+    if (null != app) {
+      MainAppWindow wnd = app.getMainWindow();
+      if (wnd != null) {
+        ArrayList<Object> p = new ArrayList<Object>();
+        // TODO MGH - this might be a default config param?
+        p.add(Integer.valueOf(0)); // get the current selection
+        ArrayList<Object> r = new ArrayList<Object>();
+        parentWindow_.sendCustomMessage(
+            CustomUIMessages.QRY_MSG_GET_CQ_QUERY_STR_FOR_EXEC, p, r);
+
+        String strQuery = null;
+        if (1 == r.size()) {
+          Object rv = r.get(0);
+          if (rv instanceof String) {
+            strQuery = (String)rv;
+          }
+        }
+
+        if (strQuery == null) {
+          p = new ArrayList<Object>();
+          p.add(Integer.valueOf(1)); // get the last query string line
+          r = new ArrayList<Object>();
+          parentWindow_.sendCustomMessage(
+              CustomUIMessages.QRY_MSG_GET_CQ_QUERY_STR_FOR_EXEC, p, r);
+
+          if (1 == r.size()) {
+            Object rv = r.get(0);
+            if (rv instanceof String) {
+              strQuery = (String)rv;
+            }
+          }
+        }
+
+        if (strQuery == null) {
+          MessageBox mb = new MessageBox(parentWindow_.getShell(), SWT.OK);
+          // MGH This happens only when the pane is empty. If a line is selected 
+          mb.setText("DataBrowser: Query Error"); 
+          mb.setMessage("No query was provided. Please select a query");
+          mb.open();
+          cqRunning(false);
+          cqRegistered(true);
+          return;
+        }
+
+        p = new ArrayList<Object>();
+        r = new ArrayList<Object>();
+
+        wnd.sendCustomMessage(
+            CustomUIMessages.QRY_MEMBER_SELECTED_FOR_QUERY_EXEC, p, r);
+
+        GemFireMember member = parentWindow_.getAssociatedMember();
+     
+        ICQueryEventListener lstnr = new CQueryEventListener();
+        CQConfiguarationPrms qryParams = new CQConfiguarationPrms(parentWindow_.getId(),lstnr);
+        qryParams.setQueryString(strQuery);
+        qryParams.setMember(member);
+        qryParams.setQueryExecutionListener(new CQueryExecListener());
+        securityProps = null;
+        executeQuery(app, qryParams);
+      }
+    }
+  }
+  
+  @Override
+  protected void errorOccuredWhileQueryExecution(Exception e){
+    DataBrowserController controller = DataBrowserApp.getInstance().getController();
+    controller.closeCq(parentWindow_.getId()); 
+    
+    String syntaxError = "";
+    if (e.getCause() instanceof QueryInvalidException) {
+      QueryInvalidException cause = (QueryInvalidException) e.getCause();
+      syntaxError = extractSyntaxErrorInfo(cause, getQueryString());
+    }
+    
+    MessageBox mb = new MessageBox(parentWindow_.getShell(), SWT.OK);
+    mb.setText("GF DataBrowser: Query Error");
+    String errorMsg = "An error occured on the member while executing the query. The message from the server is:\n" + e.getLocalizedMessage();
+    errorMsg = errorMsg + "\n" + syntaxError + "\nPlease check logs for further details.";
+    mb.setMessage(errorMsg);
+    mb.open();
+    cqRunning(false);
+    cqRegistered(true);   
+  }
+  
+  @Override
+  protected void cancelQuery(){
+    cqRunning(false);
+    cqRegistered(true);   
+  }
+
+  protected final class CQueryExecListener extends QueryExecListener {
+    private CqExecutionListener cqExecListener= new CqExecutionListener();
+    
+    private CqFailedListener cqFailedListener= new CqFailedListener();
+    
+    CQueryExecListener() {
+    }
+    
+    @Override
+    public void queryFailed(IQueryExecutedEvent queryEvent, Throwable ex) {
+      DataBrowserController controller = DataBrowserApp.getInstance().getController();
+      controller.closeCq(parentWindow_.getId()); 
+      if (parentWindow_ != null) {
+        if (parentWindow_ != null) {
+          cqFailedListener.setData(queryEvent, ex);
+          if(cqFailedListener.isProcessed()){
+            cqFailedListener.setProcessed(false);
+            Display display = parentWindow_.getShell().getDisplay();
+            display.asyncExec(cqFailedListener);  
+          }
+        }
+      }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutionListener
+     * #queryExecuted
+     * (com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutedEvent)
+     */
+    @Override
+    public void queryExecuted(IQueryExecutedEvent queryEvent) {
+      if (parentWindow_ != null) {
+        if(cqExecListener.isProcessed()){
+          cqExecListener.setProcessed(false);
+          Display display = parentWindow_.getShell().getDisplay();
+          display.asyncExec(cqExecListener);  
+        }
+      }
+    }
+  }
+  
+  private final class CQueryEventListener implements ICQueryEventListener {
+
+    CQQuery cQuery_;
+    private CqEventProcessor cqEventProcessor= new CqEventProcessor();
+
+    public void setQuery(CQQuery query) {
+      cQuery_ = query;
+      final ArrayList<Object> p = new ArrayList<Object>();
+      final ArrayList<Object> r = new ArrayList<Object>();
+      p.add(cQuery_);
+
+      parentWindow_.sendCustomMessage(
+          CustomUIMessages.QRY_MSG_SET_CQ_QUERY_FOR_DISP, p, r);
+    }
+
+    public void close() {
+      if (cQuery_ != null) {
+        cQuery_.getQueryResult().removeCQEventListener(this);
+        cQuery_.getQueryResult().removeTypeListener(this);
+      }
+    }
+
+    public void onEvent(ICQEvent cqEvent) {
+      processEvent(cqEvent);
+    }
+
+    public void onNewTypeAdded(IntrospectionResult result) {
+      processEvent(result);
+    }
+    
+    private void processEvent(Object object){
+      cqEventProcessor.addEvent(object);
+      if(cqEventProcessor.isProcessed()){
+        cqEventProcessor.setProcessed(false);
+        Display display = parentWindow_.getShell().getDisplay();
+        display.asyncExec(cqEventProcessor);  
+      }
+    }
+  }
+
+  /**
+   * Runnable to process event of running cq
+   * @author mjha
+   */
+  private  class CqEventProcessor implements Runnable{
+    private boolean processed = true;
+    private ArrayList<Object> cqEvent = new ArrayList<Object>();
+
+    public void run() {
+      processed = false;
+      ArrayList<Object> res = new ArrayList<Object>();
+      ArrayList<Object> prms= new ArrayList<Object>();
+      synchronized (cqEvent) {
+        prms.addAll(cqEvent);
+        cqEvent.clear();
+        processed = true;
+      }
+      if(parentWindow_ != null){
+        Shell shell = parentWindow_.getShell();
+        if (shell != null && !shell.isDisposed()) {
+          parentWindow_.sendCustomMessage(
+              CustomUIMessages.QRY_MSG_PROCESS_CQ_QUERY_EVT, prms, res);
+        }
+      }
+    }
+    
+    public boolean isProcessed(){
+      return processed;
+    }
+    
+    public void setProcessed(boolean processed) {
+      this.processed = processed;
+    }
+    
+    public void addEvent(Object object) {
+      synchronized (cqEvent) {
+        cqEvent.add(object);
+      }
+    }
+  }
+  
+  /**
+   * Runnable to be invoke once cq is successfully registered with server
+   * @author mjha
+   */
+  private  class CqExecutionListener implements Runnable{
+    private boolean processed = true;
+
+    public void run() {
+      processed = false;
+      cqRunning(true);
+      cqRegistered(true);
+      processed = true;
+    }
+    
+    public boolean isProcessed(){
+      return processed;
+    }
+    
+    public void setProcessed(boolean processed) {
+      this.processed = processed;
+    }
+    
+  }
+  
+  /**
+   * Runnable to be invoke once cq is failed error received
+   * @author mjha
+   */
+  private  class CqFailedListener implements Runnable{
+    private boolean processed = true;
+    private Throwable ex;
+    private IQueryExecutedEvent queryEvent;
+
+    public void run() {
+      processed = false;
+      synchronized (this) {
+        if(queryEvent != null && ex != null){
+          errorInQueryExecution(queryEvent, ex);
+          queryEvent = null;
+          ex = null;
+        }
+      }
+      cqRunning(false);
+      cqRegistered(true);
+      processed = true;
+    }
+    
+    public boolean isProcessed(){
+      return processed;
+    }
+    
+    public void setProcessed(boolean processed) {
+      this.processed = processed;
+    }
+    
+    public void setData(IQueryExecutedEvent qEvent, Throwable e){
+      synchronized (this) {
+        ex= e;
+        queryEvent = qEvent;
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteQuery.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteQuery.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteQuery.java
new file mode 100644
index 0000000..d879163
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExecuteQuery.java
@@ -0,0 +1,713 @@
+/*=========================================================================
+ * (c)Copyright 2002-2011, GemStone Systems, Inc. All Rights Reserved.
+ * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006
+ * All Rights Reserved.
+ * =======================================================================*/
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.window.ApplicationWindow;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+import com.gemstone.gemfire.cache.query.QueryInvalidException;
+import com.gemstone.gemfire.mgmt.DataBrowser.app.DataBrowserApp;
+import com.gemstone.gemfire.mgmt.DataBrowser.connection.SecurityAttributes;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.DataBrowserController;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutedEvent;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutionListener;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.InvalidConfigurationException;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.MissingSecuritiesPropException;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.QueryConfigurationPrms;
+import com.gemstone.gemfire.mgmt.DataBrowser.model.member.GemFireMember;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.QueryExecutionException;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.QueryResult;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.CustomUIMessages;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.MainAppWindow;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.SpecifySecuritiesDlg;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.SecurityPropComposite.Data;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.SecurityPropComposite.SecurityProp;
+import com.gemstone.gemfire.mgmt.DataBrowser.utils.LogUtil;
+import com.gemstone.gemfire.security.AuthenticationFailedException;
+
+/**
+ * @author mghosh
+ *
+ */
+public class ExecuteQuery extends AbstractDataBrowserAction implements
+    IRunnableWithProgress {
+
+  private String              queryString_ = null;
+  private QueryExecListener   qExecutionListener_;
+  protected Data securityProps = null;
+
+  private static final String iconEnabled  = null;
+  private static final String iconDisabled = null;
+
+  /**
+   *
+   */
+  public ExecuteQuery() {
+    super();
+  }
+
+  /**
+   * @return the queryString_
+   */
+  public final String getQueryString() {
+    return queryString_;
+  }
+
+  /**
+   * @param queryString_
+   *          the queryString_ to set
+   */
+  public final void setQueryString(String qs) {
+    queryString_ = qs;
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  public void run(IProgressMonitor monitor) throws InvocationTargetException,
+      InterruptedException {
+    // TODO Auto-generated method stub
+
+  }
+
+  // **********************************************************
+  //
+  // AbstractDataBrowserAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Execute Query";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    return iconEnabled;
+  }
+
+  // **********************************************************  //
+  // IAction stuff
+  //
+  // **********************************************************
+  //
+  // /* (non-Javadoc)
+  // * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor()
+  // */
+  // @Override
+  // public ImageDescriptor getDisabledImageDescriptor() {
+  // // TODO Auto-generated method stub
+  // return super.getDisabledImageDescriptor();
+  // }
+  //
+  // /* (non-Javadoc)
+  // * @see org.eclipse.jface.action.Action#getImageDescriptor()
+  // */
+  // @Override
+  // public ImageDescriptor getImageDescriptor() {
+  //    final String fqnImage_ = "/com/gemstone/gemfire/mgmt/DataBrowser/resources/icons/ExecuteQuery.ico";
+  // InputStream isImage = null;
+  // try {
+  // isImage = getClass().getResourceAsStream(fqnImage_);
+  //
+  // if (null != isImage) {
+  // imgEnabled_ = new Image(null, isImage);
+  // imgDescEnabled_ = ImageDescriptor.createFromImage(imgEnabled_);
+  // }
+  // } catch (NullPointerException xptn) {
+  // // handler for getResourceAsStream
+  // LogUtil.warning(
+  // "NullPointerException in ExecuteQuery.getImageDescriptor (getResourceAsStream). Continuing...",
+  // xptn );
+  // } catch (SWTException xptn) {
+  // // handler for org.eclipse.swt.graphics.Image ctor
+  // // we continue an try to add the other nodes
+  // LogUtil.warning(
+  // "SWTException in ExecuteQuery.getImageDescriptor (org.eclipse.swt.graphics.Image ctor). Continuing...",
+  // xptn );
+  // } catch (SWTError err) {
+  // // Log this (Image ctor could throw this), and rethrow
+  // LogUtil.error(
+  // "SWTError in ExecuteQuery.getImageDescriptor (org.eclipse.swt.graphics.Image ctor). This could be due to handles in the underlying widget kit being exhaused. Terminating.",
+  // err );
+  // throw err;
+  // }
+  // finally {
+  // if( null != isImage ) {
+  // try {
+  // isImage.close();
+  // } catch (IOException e) {
+  // LogUtil.warning(
+  // "IOException in QueryPrefsPage.getImageDescriptor (isImage.close(..)). Ignoring.",
+  // e );
+  // }
+  // isImage = null;
+  // }
+  // }
+  //
+  // return imgDescEnabled_;
+  // }
+  //
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Executes a GemFire OQL Query";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Execute a GemFire OQL query";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    boolean fRet = true;
+    if (null != app) {
+      DataBrowserController ctrlr = app.getController();
+      if (null != ctrlr) {
+        fRet = ctrlr.hasConnection();
+      }
+    }
+    return fRet;
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#run()
+   */
+  @Override
+  public void run() {
+    runWithEvent(new Event());
+  }
+  
+  protected ApplicationWindow getApplicationWindow() {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    return app.getMainWindow();
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event event1) {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    if (null != app) {
+      MainAppWindow wnd = (MainAppWindow)getApplicationWindow();
+      if (null != wnd) {
+        ArrayList<Object> p = new ArrayList<Object>();
+        // TODO MGH - this might be a default config param?
+        p.add(Integer.valueOf(0)); // get the current selection
+        ArrayList<Object> r = new ArrayList<Object>();
+        wnd.sendCustomMessage(CustomUIMessages.QRY_MSG_GET_QUERY_STR_FOR_EXEC,
+            p, r);
+
+        String strQuery = null;
+        if (1 == r.size()) {
+          Object rv = r.get(0);
+          if (rv instanceof String) {
+            strQuery = (String) rv;
+          }
+        }
+
+        if (strQuery == null) {
+          p = new ArrayList<Object>();
+          p.add(Integer.valueOf(1)); // get the last query string line
+          r = new ArrayList<Object>();
+          wnd.sendCustomMessage(
+              CustomUIMessages.QRY_MSG_GET_QUERY_STR_FOR_EXEC, p, r);
+
+          if (1 == r.size()) {
+            Object rv = r.get(0);
+            if (rv instanceof String) {
+              strQuery = (String) rv;
+            }
+          }
+        }
+
+        if (strQuery == null || (0 == strQuery.length())) {
+          MessageBox mb = new MessageBox(wnd.getShell(), SWT.OK);
+          mb.setText("DataBrowser Error");
+          mb.setMessage("No query string provided for execution.");
+          mb.open();
+          return;
+        }
+
+        p = new ArrayList<Object>();
+        r = new ArrayList<Object>();
+
+        wnd.sendCustomMessage(
+            CustomUIMessages.QRY_MEMBER_SELECTED_FOR_QUERY_EXEC, p, r);
+
+        GemFireMember member = null;
+        // TODO MGH - is there any possibility that multiple members could be
+        // selected?
+        if (1 == r.size()) {
+          Object rv = r.get(0);
+          if (rv instanceof GemFireMember) {
+            member = (GemFireMember) rv;
+          }
+        }
+        if (member == null) {
+          MessageBox mb = new MessageBox(wnd.getShell(), SWT.OK);
+          mb.setText("DataBrowser Error");
+          mb
+              .setMessage("A GemFire member must be selected to execute a query. Please select a member from the list.");
+          mb.open();
+          return;
+        }
+
+        QueryConfigurationPrms qryParams = new QueryConfigurationPrms();
+        qryParams.setQueryString(strQuery);
+        qryParams.setMember(member);
+
+        if (qExecutionListener_ == null)
+          qExecutionListener_ = new QueryExecListener();
+
+        qryParams.setQueryExecutionListener(qExecutionListener_);
+        securityProps = null;
+        executeQuery(app, qryParams);
+      }
+    }
+  }
+
+  protected void executeQuery(DataBrowserApp app,
+      QueryConfigurationPrms qryParams) {
+    boolean retry = false;
+    do {
+      retry = false;
+      try {
+        LogUtil.fine("ExecuteQuery.runWithEvent: About to execute.");
+        setQueryString(qryParams.getQueryString());
+        app.getController().executeQuery(qryParams);
+        retry = false;
+      }
+      catch (InvalidConfigurationException xptn) {
+        LogUtil.error("ExecuteQuery.runWithEvent: Could not execute query.",
+            xptn);
+        retry = false;
+        errorOccuredWhileQueryExecution(xptn);
+      }
+      catch (QueryExecutionException e) {
+        LogUtil.error("ExecuteQuery.runWithEvent: Could not execute query.", e);
+        retry = false;
+        errorOccuredWhileQueryExecution(e);
+      }
+      catch (MissingSecuritiesPropException e) {
+        MessageBox mb = new MessageBox(app.getMainWindow().getShell(), SWT.YES
+            | SWT.NO);
+        mb.setText("DataBrowser Error");
+        mb
+            .setMessage("Security is enabled on the server.\nWould you like to specify the security properties and execute the query again?");
+        int open = mb.open();
+        if (open == SWT.YES) {
+          boolean popUpSpecifySecurityDlg = popUpSpecifySecurityDlg();
+          if (popUpSpecifySecurityDlg)
+            retry = true;
+          else{
+            retry = false;
+            cancelQuery();
+          }
+        }
+      }
+      catch (AuthenticationFailedException ex) {
+        MessageBox mb = new MessageBox(getApplicationWindow().getShell(),
+            SWT.YES | SWT.NO);
+        mb.setText("DataBrowser Error");
+
+        String errMsg = ex.getMessage() + " " + qryParams.getQueryString();
+        errMsg = errMsg
+            + ". \n"
+            + "Would you like to specify security properties and execute the query again ?";
+        mb.setMessage(errMsg);
+        int iRetry = mb.open();
+        if (SWT.YES == iRetry) {
+          boolean popUpSpecifySecurityDlg = popUpSpecifySecurityDlg();
+          if (popUpSpecifySecurityDlg) {
+            retry = true;
+          }
+        }
+        if(!retry)
+          cancelQuery();
+      } finally {
+	      /* un-setting query string as currently it's not required further. */
+        setQueryString(null); 
+      }
+
+    } while (retry);
+  }
+
+  /**
+   * This is suppose to do clean up, if any, once error happened while query
+   * execution
+   *
+   * @param e
+   */
+  protected void errorOccuredWhileQueryExecution(Exception e) {
+
+  }
+  
+  /**
+   * cancel the query execution if query already running
+   */
+  protected void cancelQuery(){
+    
+  }
+
+  private boolean popUpSpecifySecurityDlg() {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    Shell shl = getApplicationWindow().getShell();
+    SpecifySecuritiesDlg dlg = new SpecifySecuritiesDlg(shl);
+
+    String errMsg = null;
+    boolean fPromptForRetry = false;
+    boolean fRetry = false;
+    boolean okPressed = false;
+    do {
+      fRetry = false;
+      fPromptForRetry = false;
+      okPressed = false;
+      dlg.setSecurityData(securityProps);
+      int iRetCode = dlg.open();
+      fRetry = false;
+      if (Window.OK == iRetCode) {
+        okPressed = true;
+        DataBrowserController cntrlr = DataBrowserApp.getInstance()
+            .getController();
+        SecurityAttributes sAttrs = new SecurityAttributes();
+
+        securityProps = dlg.getData();
+
+        String pluginJarFQN = securityProps.getSecurityPlugin();
+        List<SecurityProp> secProperties = securityProps.getSecurityProperties();
+
+        if ((pluginJarFQN.trim().length() == 0)) {
+          fPromptForRetry = true;
+          errMsg = "No Security plugin provided. \nWould you like to specify security properties again ?";
+        }
+        if (true == fPromptForRetry) {
+          if (null != errMsg) {
+            LogUtil.error(errMsg);
+          }
+          MessageBox mb = new MessageBox(shl, SWT.YES | SWT.NO);
+          mb.setText( "Warning" );
+          if (null == errMsg) {
+            errMsg = "No Security plugin provided. \nWould you like to specify security properties again ?";
+          }
+
+          mb.setMessage(errMsg);
+          int iRetry = mb.open();
+          fRetry = (SWT.YES == iRetry) ? true : false;
+
+        } else {
+          sAttrs.setSecurityPluginPath(pluginJarFQN);
+          Map<String, String> props = new HashMap<String, String>();
+          for (int i = 0; i < secProperties.size(); i++) {
+            SecurityProp securityProp = secProperties.get(i);
+            String key = securityProp.getKey();
+            String value = securityProp.getValue();
+            props.put(key, value);
+          }
+
+          sAttrs.setSecurityProperties(props);
+          cntrlr.setSecurityAttributes(sAttrs);
+        }
+      }
+    } while (true == fRetry);
+
+    return okPressed;
+  }
+
+  protected void errorInQueryExecution(IQueryExecutedEvent queryEvent,
+      Throwable ex) {
+
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    final ApplicationWindow wnd = getApplicationWindow();
+    if (ex instanceof QueryExecutionException) {
+      QueryExecutionException qEx = (QueryExecutionException) ex;
+      if (qEx.isAuthenticationFailed()) {
+        reExecuteQuery(queryEvent, ex);
+        return;
+      } else if (qEx.isAuthorizationFailed()) {
+        MessageBox mb = new MessageBox(wnd.getShell(), SWT.OK);
+        mb.setText("DataBrowser Error");
+        mb.setMessage("An error occurred during executing the query:\t"
+            + queryEvent.getQueryString() + "\n\n" + "Error Details = "
+            + ex.getMessage());
+        mb.open();
+        return;
+      }
+    }
+    if (ex instanceof AuthenticationFailedException) {
+      reExecuteQuery(queryEvent, ex);
+      return;
+    }
+    
+    MessageBox mb = new MessageBox(wnd.getShell(), SWT.OK);
+    mb.setText("DataBrowser Error");
+    String errorMessage = "Following error occurred: \n";;
+
+    String syntaxError = "";
+    if (ex instanceof QueryInvalidException) {
+      syntaxError = extractSyntaxErrorInfo((QueryInvalidException)ex, queryEvent.getQueryString());
+    }
+
+    if (ex != null && (ex.getMessage() != null)) {
+      errorMessage = errorMessage + ex.getMessage();
+    } else {
+      String exception = String.valueOf(ex);
+      errorMessage = errorMessage + exception;
+    }
+    mb.setMessage(errorMessage + "\n" + syntaxError + "\nPlease check logs for further details.");
+
+    mb.open();
+  }
+  
+  protected String extractSyntaxErrorInfo(QueryInvalidException ex, String queryString) {
+    String syntaxError = "";
+
+    antlr.RecognitionException recogException = null;
+    Throwable cause = ex.getCause();
+    if (cause instanceof antlr.TokenStreamRecognitionException) {
+      recogException = ((antlr.TokenStreamRecognitionException) cause).recog;
+    } else if (cause instanceof antlr.RecognitionException) {
+      recogException = (antlr.RecognitionException) cause;
+    }
+
+    if (recogException != null) {
+      int errorAt = recogException.getColumn();
+      if (queryString != null) {
+        queryString = queryString.trim(); //trims spaces & \r
+        int queryLength = queryString.length();
+        
+        StringBuilder errorPointer = new StringBuilder();
+        for (int i = 0; i <= queryLength; i++) {
+          if (i == errorAt - 1) {
+            errorPointer.append("^");
+          } else {
+            errorPointer.append("-");
+          }
+        }
+        LogUtil.error(ex.getMessage() + "\n\t" + queryString 
+                      + "\n\t" + errorPointer.toString());
+      }
+      /*
+       * Line number information is also available. But it's for the line number
+       * for a multi line query and it is not the line number on the UI. Hence,
+       * skipping line number for now as it will be confusing to the user
+       */
+      syntaxError = "In the query string for character at position: " + errorAt;
+    }
+    return syntaxError;
+  }
+
+  private void reExecuteQuery(IQueryExecutedEvent queryEvent, Throwable ex) {
+
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    ApplicationWindow wnd = getApplicationWindow();
+
+    MessageBox mb = new MessageBox(wnd.getShell(), SWT.YES | SWT.NO);
+    mb.setText("DataBrowser Error");
+
+    String errMsg = ex.getMessage() + " " + queryEvent.getQueryString();
+    errMsg = errMsg + ". \n" + "Would you like to specify security properties and execute the query again ?";
+    mb.setMessage(errMsg);
+    int iRetry = mb.open();
+
+    boolean fPromptForRetry = (SWT.YES == iRetry) ? true : false;
+    if (fPromptForRetry) {
+      boolean popUpSpecifySecurityDlg = popUpSpecifySecurityDlg();
+      if (popUpSpecifySecurityDlg) {
+        QueryConfigurationPrms qryParams = new QueryConfigurationPrms();
+        qryParams.setQueryString(queryEvent.getQueryString());
+        qryParams.setMember(queryEvent.getMember());
+        qryParams.setQueryExecutionListener(new QueryExecListener());
+        executeQuery(app, qryParams);
+      }else{
+        cancelQuery();
+      }
+    }
+  }
+
+  protected class QueryExecListener implements IQueryExecutionListener {
+    private QueryResultProcessor queryResultProcessor = new QueryResultProcessor();
+
+    QueryExecListener() {
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutionListener
+     * #queryExecuted
+     * (com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutedEvent)
+     */
+    public void queryExecuted(IQueryExecutedEvent queryEvent) {
+      QueryResult qryres = queryEvent.getQueryResult();
+
+      DataBrowserApp app = DataBrowserApp.getInstance();
+      ApplicationWindow wnd = getApplicationWindow();
+
+      queryResultProcessor.addResults(qryres);
+      if (queryResultProcessor.isProcessed()) {
+        queryResultProcessor.setProcessed(false);
+        runTaskInAsyncUIThread(wnd.getShell(), queryResultProcessor);
+      }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutionListener
+     * #queryFailed
+     * (com.gemstone.gemfire.mgmt.DataBrowser.controller.IQueryExecutedEvent,
+     * java.lang.Throwable)
+     */
+    public void queryFailed(final IQueryExecutedEvent queryEvent,
+        final Throwable ex) {
+      if (ex != null) {
+        LogUtil.error("Error while executing query: ", ex);
+      }
+
+      DataBrowserApp app = DataBrowserApp.getInstance();
+      final ApplicationWindow wnd = getApplicationWindow();
+      Runnable runnable = new Runnable() {
+        public void run() {
+          errorInQueryExecution(queryEvent, ex);
+        }
+      };
+
+      runTaskInAsyncUIThread(wnd.getShell(), runnable);
+    }
+
+    private void runTaskInAsyncUIThread(Shell shell, Runnable runnable) {
+      Display display = shell.getDisplay();
+      display.asyncExec(runnable);
+    }
+
+  }
+
+  private static class QueryResultProcessor implements Runnable {
+    private boolean processed    = true;
+    QueryResult     queryResults = null;
+
+    public void run() {
+      processed = false;
+      ArrayList<Object> res = new ArrayList<Object>();
+      ArrayList<Object> prms = new ArrayList<Object>();
+
+      if (queryResults == null) {
+        processed = true;
+        return;
+      }
+
+      synchronized (this) {
+        prms.add(queryResults);
+        queryResults = null;
+        processed = true;
+      }
+      DataBrowserApp app = DataBrowserApp.getInstance();
+      if (null != app) {
+        final MainAppWindow wnd = app.getMainWindow();
+        if (wnd != null) {
+          Shell shell = wnd.getShell();
+          if (shell != null && !shell.isDisposed()) {
+            wnd.sendCustomMessage(
+                CustomUIMessages.QRY_MSG_ADD_QUERY_SINGLE_RESULT, prms, res);
+          }
+        }
+      }
+    }
+
+    public boolean isProcessed() {
+      return processed;
+    }
+
+    public void setProcessed(boolean processed) {
+      this.processed = processed;
+    }
+
+    public void addResults(QueryResult qryres) {
+      if (queryResults == null) {
+        queryResults = qryres;
+        return;
+      }
+      synchronized (this) {
+        queryResults = qryres;
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Exit.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Exit.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Exit.java
new file mode 100644
index 0000000..f97ceee
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Exit.java
@@ -0,0 +1,94 @@
+/**
+ * 
+ */
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import org.eclipse.swt.widgets.Event;
+
+import com.gemstone.gemfire.mgmt.DataBrowser.app.DataBrowserApp;
+
+/**
+ * @author mghosh
+ * 
+ */
+public class Exit extends AbstractDataBrowserAction {
+
+  private static final String iconEnabled = null;
+  private static final String iconDisabled = null;
+
+  // SelectionListener lstnrSel_ = new ExitSelectionHandler( this );
+
+  /**
+	 * 
+	 */
+  public Exit() {
+    super();
+  }
+
+  // *****************************************************************
+  //
+  // IAction stuff
+  //
+  // *****************************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Exit";
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    return iconEnabled;
+  }
+
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Exits the GemFire DataBrowser"; 
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Exit the GemFire DataBrowser application";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event arg0) {
+    DataBrowserApp.getInstance().exit();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExportQueryResults.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExportQueryResults.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExportQueryResults.java
new file mode 100644
index 0000000..602abb9
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/ExportQueryResults.java
@@ -0,0 +1,366 @@
+/**
+ *
+ */
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.MessageBox;
+
+import com.gemstone.gemfire.mgmt.DataBrowser.app.DataBrowserApp;
+import com.gemstone.gemfire.mgmt.DataBrowser.controller.DataBrowserController;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.ColumnNotFoundException;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.ColumnValueNotAvailableException;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.export.QueryResultExporter;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.export.QuerySchemaExporter;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.export.xml.XMLDocExportHandler;
+import com.gemstone.gemfire.mgmt.DataBrowser.query.export.xml.XMLSchemaExportHandler;
+import com.gemstone.gemfire.mgmt.DataBrowser.ui.MainAppWindow;
+import com.gemstone.gemfire.mgmt.DataBrowser.utils.LogUtil;
+
+/**
+ * @author mghosh
+ *
+ */
+public class ExportQueryResults extends AbstractDataBrowserAction implements
+    IRunnableWithProgress {
+
+  private static final String iconEnabled = null;
+  private static final String iconDisabled = null;
+
+  private static final int BLOCK_SIZE_CONST = 1024 * 64;
+
+  private String queryString_ = null;
+  private String xmlFilePath = null;
+  private volatile boolean opResult = false;
+  private String logMsg = null;
+  private Throwable errThrwn = null;
+  private ProgressMonitorDialog dlg = null;
+
+  /**
+   *
+   */
+  public ExportQueryResults() {
+    super();
+  }
+
+  /**
+   * @return the queryString_
+   */
+  public final String getQueryString() {
+    return queryString_;
+  }
+
+  /**
+   * @param queryString_
+   *          the queryString_ to set
+   */
+  public final void setQueryString(String qs) {
+    queryString_ = qs;
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  public void run(IProgressMonitor monitor) throws InvocationTargetException,
+      InterruptedException {
+
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    DataBrowserController controller = app.getController();
+
+    if (!controller.hasConnection()
+        || (controller.getLastQueryResults() == null))
+      return;
+
+
+    final File doc_file = new File(this.xmlFilePath);
+    XMLDocExportHandler doc_handler = null;
+    QueryResultExporter export = null;
+    XMLSchemaExportHandler schema_handler = null;
+
+
+    String result = null;
+    String schema = null;
+    try {
+      doc_handler = new XMLDocExportHandler(doc_file);
+      export = new QueryResultExporter(doc_handler, -1);
+      schema_handler = new XMLSchemaExportHandler();
+
+      monitor.subTask("Exporting the Query results as XML document...");
+      export.exportData(controller.getLastQueryResults());
+      result = doc_handler.getResultDocument().toString();
+      monitor.worked(20);
+
+      monitor.subTask("Exporting the schema of the Query results as XSD document...");
+      QuerySchemaExporter.exportSchema(schema_handler, controller
+          .getLastQueryResults());
+      schema = schema_handler.getSchema();
+      monitor.worked(20);
+    }
+    catch( ColumnNotFoundException xptn ) {
+      opResult = true;
+      errThrwn = xptn;
+      if( null == result ) {
+        logMsg = "ColumnNotFoundException thrown transforming results to XML during export.";
+      }
+      else {
+        logMsg = "ColumnNotFoundException thrown transforming schema to XML during export.";
+      }
+    }
+    catch( ColumnValueNotAvailableException xptn ) {
+      opResult = true;
+      errThrwn = xptn;
+      logMsg = "ColumnValueNotAvailableException thrown transforming results to XML during export.";
+
+    } catch (IOException e) {
+      opResult = true;
+      errThrwn = e;
+      logMsg = "IOException thrown transforming results to XML during export.";
+    } finally {
+      if(doc_handler != null) {
+        try {
+          doc_handler.close();
+        } catch (IOException e) {
+          opResult = true;
+          errThrwn = e;
+          logMsg = "IOException thrown saving the XML result to disk.";
+        }
+      }
+    }
+
+    FileWriter writer = null;
+
+    final File parent_dir = doc_file.getParentFile();
+    // Output the schema (XSD) file.
+    if( false == opResult ) {
+      String fileName = doc_file.getName();
+      int index = fileName.lastIndexOf('.');
+      if(index > 0) {
+    	fileName = fileName.substring(0, index);
+      }
+      fileName = fileName + ".xsd";
+
+      monitor.subTask("Saving the XSD document to the file system...");
+      Thread.sleep(5000);
+      File schema_file = new File(parent_dir, fileName);
+      try {
+        writer = new FileWriter(schema_file);
+        int start = 0 ;
+        while(start < schema.length()) {
+          int end = ((schema.length() - start) > BLOCK_SIZE_CONST ) ? BLOCK_SIZE_CONST : (schema.length() - start);
+          writer.write(schema, start, end);
+          writer.flush();
+          start += end;
+         }
+      } catch (IOException xptn) {
+        opResult = true;
+        errThrwn = xptn;
+        if (null != writer) {
+          logMsg = "Exception thrown while writing to, flushing, or closing the XSD file "
+              + schema_file + " during export.";
+        } else {
+          logMsg = "Unable to create FileWriter for " + schema_file;
+        }
+      }
+      finally {
+        if( null != writer ) {
+          try {
+            writer.close();
+          } catch( IOException xptn ) {
+            logMsg = "Exception thrown while closing the XSD file: " + schema_file;
+            LogUtil.warning( logMsg, xptn );
+            logMsg = null;
+          }
+
+          writer = null;
+        }
+      } // for XSD file
+    } // if( false == failed )
+    monitor.worked(30);
+  }
+
+  // **********************************************************
+  //
+  // AbstractDataBrowserAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Export Results...";
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction#getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    return iconEnabled;
+  }
+
+
+  // **********************************************************
+  //
+  // IAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Export the Query Results into xml";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Export the Query Results into xml";
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see org.eclipse.jface.action.Action#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    boolean fRet = false;
+    if (null != app) {
+      DataBrowserController ctrlr = app.getController();
+      if (null != ctrlr)
+        fRet = (ctrlr.getLastQueryResults() != null);
+    }
+    return fRet;
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event event) {
+    DataBrowserApp app = DataBrowserApp.getInstance();
+    DataBrowserController controller = app.getController();
+
+    // TODO : Display proper message if there is no query result to export.
+    // TODO MGH - Is the table emptied when there is no connection? If data is still displayed
+    //            the user should be able to export.
+    if (!controller.hasConnection()
+        || (controller.getLastQueryResults() == null))
+      return;
+
+    final MainAppWindow wnd = app.getMainWindow();
+    boolean fRetry = false;
+    String path;
+
+    //Step 1 : Fetch the information about the path of File system, where the result is to be saved.
+    //Check if we have proper access permissions for saving the file. If not prompt user for some other location.
+    do {
+      fRetry = false;
+      FileDialog dialog = new FileDialog(wnd.getShell(), SWT.SAVE);
+      dialog.setOverwrite(true);
+      dialog.setFilterExtensions(new String[] { "*.xml" });
+      path = dialog.open();
+
+      if(null != path) {
+        File temp = new File(path);
+        if(temp.exists()) {
+          if(!temp.canWrite()) {
+            MessageBox mb = new MessageBox(wnd.getShell(), SWT.YES | SWT.NO);
+            mb.setText("Error: Unable to export results");
+            mb.setMessage( "User permissions do not allow writes to this file." + "\nWould you like to reattempt to export to other location ?");
+
+            int iRetry = mb.open();
+            fRetry = (SWT.YES == iRetry) ? true : false;
+          }
+
+        } else {
+          File parent = temp.getParentFile();
+          if(!parent.canWrite()) {
+            MessageBox mb = new MessageBox(wnd.getShell(), SWT.YES | SWT.NO);
+            mb.setText("Error: Unable to export results");
+            mb.setMessage("User permissions do not allow writes to this directory." + "\nWould you like to reattempt to export to other location ?" );
+
+            int iRetry = mb.open();
+            fRetry = (SWT.YES == iRetry) ? true : false;
+          }
+        }
+      } else {
+        fRetry = false;
+      }
+
+    } while( true == fRetry);
+
+    //Step 2 : Perform the actual export operation.
+    if (path != null) {
+      this.xmlFilePath = path;
+      this.opResult = false;
+      this.logMsg = null;
+      this.errThrwn = null;
+
+      try {
+        dlg = new ProgressMonitorDialog(app.getMainWindow().getShell());
+        dlg.run(true, false, this);
+     } catch (Exception e) {
+       this.errThrwn = e;
+       this.opResult = true;
+     }
+
+      if (true == opResult) {
+        LogUtil.error( logMsg, errThrwn );
+
+        MessageBox mb = new MessageBox(wnd.getShell(), SWT.OK);
+        mb.setText("Error: Unable to export results");
+        // TODO - MGH - will getLogDir return anything sensible; can we get the FQN of the log file itself?
+        mb.setMessage( logMsg + "\nPlease check the log file in " + LogUtil.getLogDir() + " for more details");
+        mb.open();
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/HelpContents.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/HelpContents.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/HelpContents.java
new file mode 100644
index 0000000..c0c3ee9
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/HelpContents.java
@@ -0,0 +1,205 @@
+/*========================================================================= 
+ * (c)Copyright 2002-2011, GemStone Systems, Inc. All Rights Reserved.
+ * 1260 NW Waterhouse Ave., Suite 200, Beaverton, OR 97006 
+ * All Rights Reserved.
+ * =======================================================================*/
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.program.Program;
+import org.eclipse.swt.widgets.Event;
+
+import com.gemstone.gemfire.mgmt.DataBrowser.utils.LogUtil;
+
+/**
+ * @author mghosh
+ * 
+ */
+public final class HelpContents extends AbstractDataBrowserAction implements
+    IRunnableWithProgress {
+
+  private static final String iconEnabled  = null;
+  private static final String iconDisabled = null;
+
+  private static final String fileNameUM_  = "index.html";
+  private static String fqnUM_ = null;
+//  private static URI          userManualURI_;
+
+  private static boolean      fEnabled_    = true;
+
+  static {
+    try {
+      Class<?> clz = Class
+          .forName("com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.HelpContents");
+      String umLoc = clz.getProtectionDomain().getCodeSource().getLocation()
+          .getPath();
+      final String uncSeparator = "/";
+
+      // Remove trailing edge "/"
+      int lastIndex = umLoc.lastIndexOf(uncSeparator);
+      if (lastIndex == umLoc.length() - 1) {
+        umLoc = umLoc.substring(0, lastIndex);
+        lastIndex = umLoc.lastIndexOf(uncSeparator);
+      }
+
+      umLoc = umLoc.substring(0, lastIndex);
+
+      // Go to jarFile/../..
+      lastIndex = umLoc.lastIndexOf(uncSeparator);
+      umLoc = umLoc.substring(0, lastIndex);
+
+      HelpContents.fqnUM_ = umLoc + uncSeparator + "docs" + uncSeparator
+          + HelpContents.fileNameUM_;
+      File file = new File(HelpContents.fqnUM_);
+      if (false == file.exists()) {
+        HelpContents.fEnabled_ = false;
+        LogUtil.info("DataBrowser User Manual " + file.getPath() + " does not exist.");
+      } else {
+        LogUtil.info("DataBrowser User Manual path is " + file.getPath());
+        //HelpContents.userManualURI_ = file.toURI();
+      }
+    } catch (Throwable t) {
+      LogUtil.error("DataBrowser UserManual ( " + HelpContents.fqnUM_
+          + " ) could not be loaded.", t);
+      HelpContents.fEnabled_ = false;
+    }
+  }
+
+  /**
+   *
+   */
+  public HelpContents() {
+    super();
+  }
+
+  // **********************************************************
+  //
+  // IRunnableWithProgress
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.
+   * runtime.IProgressMonitor)
+   */
+  public void run(IProgressMonitor monitor) throws InvocationTargetException,
+      InterruptedException {
+  }
+
+  // **********************************************************
+  //
+  // AbstractDataBrowserAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getText()
+   */
+  @Override
+  public String getText() {
+    return "Help...";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getDisabledIcon()
+   */
+  @Override
+  public String getDisabledIcon() {
+    return iconDisabled;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.AbstractDataBrowserAction
+   * #getEnabledIcon()
+   */
+  @Override
+  public String getEnabledIcon() {
+    return iconEnabled;
+  }
+
+  // **********************************************************
+  //
+  // IAction stuff
+  //
+  // **********************************************************
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getDescription()
+   */
+  @Override
+  public String getDescription() {
+    return "Displays DataBrowser User Manual";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#getToolTipText()
+   */
+  @Override
+  public String getToolTipText() {
+    return "Show the User Manual";
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#isEnabled()
+   */
+  @Override
+  public boolean isEnabled() {
+    return HelpContents.fEnabled_;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.action.Action#run()
+   */
+  @Override
+  public void run() {
+    super.run();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+   */
+  @Override
+  public void runWithEvent(Event event) {
+    /*
+    if (Desktop.isDesktopSupported()) {
+      try {
+        Desktop desktop = Desktop.getDesktop();
+        desktop.browse(HelpContents.userManualURI_);
+      } catch (IOException e) {
+        LogUtil.error( "Could not launch user manual for viewing.",  e );
+      }
+    }
+    */
+   
+    Program.launch( "file://" + HelpContents.fqnUM_ );
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/IDataBrowserAction.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/IDataBrowserAction.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/IDataBrowserAction.java
new file mode 100644
index 0000000..24671f5
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/IDataBrowserAction.java
@@ -0,0 +1,16 @@
+/**
+ * 
+ */
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import org.eclipse.swt.events.SelectionListener;
+
+/**
+ * @author mghosh
+ * 
+ */
+public interface IDataBrowserAction {
+  String label();
+
+  SelectionListener getSelectionListener();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1709e627/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Messages.java
----------------------------------------------------------------------
diff --git a/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Messages.java b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Messages.java
new file mode 100644
index 0000000..339c921
--- /dev/null
+++ b/databrowser/src/com/gemstone/gemfire/mgmt/DataBrowser/ui/actions/Messages.java
@@ -0,0 +1,22 @@
+package com.gemstone.gemfire.mgmt.DataBrowser.ui.actions;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+  private static final String         BUNDLE_NAME     = "com.gemstone.gemfire.mgmt.DataBrowser.ui.actions.messages";
+
+  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+                                                          .getBundle(BUNDLE_NAME);
+
+  private Messages() {
+  }
+
+  public static String getString(String key) {
+    try {
+      return RESOURCE_BUNDLE.getString(key);
+    } catch (MissingResourceException e) {
+      return '!' + key + '!';
+    }
+  }
+}


Mime
View raw message