[kepler-dev] [kepler-cvs] kepler/src/org/ecoinformatics/seek/datasource EcogridDataCacheItem.java
Matthew Jones
jones at nceas.ucsb.edu
Wed Feb 13 17:48:53 PST 2008
Jing,
I noticed you're having difficulty with calling the ecogrid data access
classes from within JUnit tests. This illustrates an underlying problem
in the implementation -- that it depends on GUI classes -- that would
also surface when running kepler in headless mode on the command line or
behind a web interface. Rather than calling JOptionPane directly, you
should probably be callinga mediator class like
ptolemy.util.MessageHandler that can be configured to do different
things depending on whether it has a GUI available or just stdout
available. This design follows the basic Mediator pattern and would
help in improving the overall design. I think anytime you are
instantiating Swing components in an actor we are possibly limiting the
execution environment of the actor.
Can you factor out these alerts so that the use the mediator pattern?
Matt
Jing Tao wrote:
> tao 08/02/13 17:08:15
>
> Modified: src/org/ecoinformatics/seek/datasource
> EcogridDataCacheItem.java
> Log:
> Add a flag - showAlter. If this set false, the alter window would not show up. This is used in junit test.
>
> Revision Changes Path
> 1.37 +22 -8 kepler/src/org/ecoinformatics/seek/datasource/EcogridDataCacheItem.java
>
> Index: EcogridDataCacheItem.java
> ===================================================================
> RCS file: /cvs/kepler/src/org/ecoinformatics/seek/datasource/EcogridDataCacheItem.java,v
> retrieving revision 1.36
> retrieving revision 1.37
> diff -u -r1.36 -r1.37
> --- EcogridDataCacheItem.java 13 Feb 2008 00:31:31 -0000 1.36
> +++ EcogridDataCacheItem.java 14 Feb 2008 01:08:15 -0000 1.37
> @@ -2,8 +2,8 @@
> * '$RCSfile: EcogridDataCacheItem.java,v $'
> *
> * '$Author: tao $'
> - * '$Date: 2008/02/13 00:31:31 $'
> - * '$Revision: 1.36 $'
> + * '$Date: 2008/02/14 01:08:15 $'
> + * '$Revision: 1.37 $'
> *
> * For Details: http://kepler.ecoinformatics.org
> *
> @@ -68,6 +68,7 @@
> protected String mEndPoint = null;
> private boolean mIsTarFile = false;
> private String mEntityIdentifier = null;
> + private boolean showAlert = true;
>
> private static Log log;
> static {
> @@ -334,12 +335,15 @@
> log.error("EcogridDataCacheItem - error connecting to Ecogrid ", ee);
> cleanUpCache(bos);
> // Alert user about possible permission issue (BRL:20070918)
> - JOptionPane.showMessageDialog(
> - null,
> - "There has been a problem accessing the remote data:\n"
> - + ee.getMessage(),
> - "Alert",
> - JOptionPane.ERROR_MESSAGE);
> + if (showAlert)
> + {
> + JOptionPane.showMessageDialog(
> + null,
> + "There has been a problem accessing the remote data:\n"
> + + ee.getMessage(),
> + "Alert",
> + JOptionPane.ERROR_MESSAGE);
> + }
> return CACHE_ERROR;
> }
>
> @@ -377,4 +381,14 @@
> }
>
> }
> +
> + /**
> + * Set up the value of showAltert. If showAlter=true, the alter window will show up if some
> + * error happens.
> + * @param showAlert
> + */
> + public void setShowAlterWindow(boolean showAlert)
> + {
> + this.showAlert = showAlert;
> + }
> }
>
>
>
> _______________________________________________
> Kepler-cvs mailing list
> Kepler-cvs at ecoinformatics.org
> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-cvs
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Matthew B. Jones
Director of Informatics Research and Development
National Center for Ecological Analysis and Synthesis (NCEAS)
UC Santa Barbara
jones at nceas.ucsb.edu Ph: 1-907-523-1960
http://www.nceas.ucsb.edu/ecoinfo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Kepler-dev
mailing list