org.autoplot.datasource.DataSourceUtil
DataSource utilities.
DEFAULT_TIME_RANGE
used in Autoplot's Application object and in the DataSetSelector.
addMakeAggregationForScheme
addMakeAggregationForScheme( String scheme, org.autoplot.datasource.DataSourceUtil.URIMap map ) → void
register a map which might modify a URI so that it uses aggregation.
This was introduced for "vap+inline" URIs which must be taken apart and
then each of the getDataSet calls is aggregated.
Parameters
scheme - the scheme where this should be used, e.g. "vap+inline"
map - the map, which might return the input URI or an aggregated one.
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
findAggregations
findAggregations( java.util.List files, boolean remove ) → List
return the aggregations we can find.
If remove is true, then the input list will have all items
removed that are not part of an aggregation.
Parameters
files - a java.util.List
remove - remove the files that are accounted for by the aggregation.
Returns:
list of aggregations found.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
findAggregations( java.util.List files, boolean remove, boolean loose ) → List
getMessage
getMessage( java.lang.Exception ex ) → String
return a one-line string representation of the exception. This was introduced
when a NullPointerException was represented as "null", and it was somewhat
unclear about what was going on.
Parameters
ex - an exception
Returns:
a 1-line string representation of the error, for the end user.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getTimeSeriesBrowse
getTimeSeriesBrowse( org.autoplot.datasource.DataSource dss ) → TimeSeriesBrowse
for IDL, where I can't look up a class
Parameters
dss - a DataSource
Returns:
an org.autoplot.datasource.capability.TimeSeriesBrowse
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
getXPathFactory
getXPathFactory( ) → XPathFactory
Matlab uses net.sf.saxon.xpath.XPathEvaluator by default, so we explicitly look for the Java 6 one.
Returns:
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl, probably.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
guessNameFor
guessNameFor( String uri ) → String
returns a variable name generated from the URI. This was written for Jython scripting. A future
version of this might attempt to load the resource, and use the name from the result.
Parameters
uri - a String
Returns:
a String
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
guessNameFor( String uri, java.util.List otherURIs, java.util.List otherNames ) → String
guessRenderType
guessRenderType( QDataSet fillds ) → String
Parameters
fillds - a QDataSet
Returns:
a String
See Also:
Autoplot org.autoplot.AutoplotUtil.guessRenderType. org.autoplot.AutoplotUtil.guessRenderType.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
isConstant
isConstant( java.lang.String[] others, int st, int en ) → boolean
return true if the characters in the range st to en do not change.
Parameters
others - a java.lang.String[]
st - an int
en - an int
Returns:
a boolean
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
isHtmlStream
isHtmlStream( String text ) → boolean
returns true if the text appears to be html. Right now the test is
for "
Parameters
text - the text.
Returns:
true if the stream appears to be html.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
isJavaDouble
isJavaDouble( String myString ) → boolean
from java.lang.Double javadoc, this tests if a number is a double.
Parameters
myString - a String
Returns:
true if the number is a double.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
isJavaIdentifier
isJavaIdentifier( String label ) → boolean
return true if the string is a java identifier.
Parameters
label - a String
Returns:
a boolean
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
main
main( java.lang.String[] args ) → void
Parameters
args - a java.lang.String[]
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
makeAggregation
makeAggregation( String surl, java.lang.String[] surls ) → String
attempt to make an aggregation from the URLs. If one cannot be created
(for example if the filenames are not consistent), then the original
URI is returned.
Parameters
surl - a String
surls - a java.lang.String[]
Returns:
a String
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
makeAggregation( String surl ) → String
makeAggregationForGroup
makeAggregationForGroup( String surl, java.lang.String[] others ) → String
attempt to create a String that uses an aggregation template
instead of the particular time. This also return null when things
go wrong. For example,
file:/tmp/20091102.dat -> file:/tmp/$Y$m$d.dat?timerange=20091102
Also, look for version numbers. If multiple periods are found, then use
$(v,sep) otherwise use numeric $v.
ss= [ "1991_095/1993/19930303.dat","1991_095/1993/19930304.dat","1991_095/1991/19930305.dat" ]
y= makeAggregationForGroup("1991_095/1993/19930303.dat",ss) // 1991_095/$Y/$Y$m$d.dat?timerange=2009-11-02
Parameters
surl - the URI.
others - other URIs in the group, used to reject solutions which would not produce unique results.
Returns:
null or the string with aggregations ($Y.dat) instead of filename (1999.dat), or the original filename.
See Also:
https://github.com/autoplot/dev/blob/master/bugs/sf/0484/makeAggregationForGroup_001.jy
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
newURL
newURL( java.net.URL context, String spec ) → URL
interprets spec within the context of URL context.
Parameters
context - the context for the spec. null may be used to
indicate no context.
spec - if spec is a fully specified URL, then it is used, otherwise
it is appended to context. If spec refers to the name of a file,
but doesn't start with "file:/", "file:/" is appended.
Returns:
the URL.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
openBrowser
openBrowser( String url ) → void
open the URL in a browser. Borrowed from http://www.centerkey.com/java/browser/.
See also openBrowser in Autoplot,
which this replaces.
Java 6 introduced standard code for doing this. The old code is still
used in case there's a problem.
Parameters
url - the URL
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
parseConstraint
parseConstraint( String constraint, long[] qubeDims ) → Map
returns the [ start, stop, stride ] or [ start, -1, -1 ] for slice, but also
supports slice notations like [:,1]. This is
provided to reduce code and for uniform behavior.
Examples:
- [::1,:] -> { 0:[0,l0,1], 1:[1,l1,1] }
- [:,2] -> { 0:[0,l0,1], 1:[2,-1,-1] } //TODO: verify
This returns a map from dimension (0,1,...,rank-1) to [ start, stop, stride ].
Parameters
constraint - a String
qubeDims - the dimension of the data.
Returns:
the [startRecord,stopRecordExclusive,stride] for each index.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
parseConstraint( String constraint, long recCount ) → long
setTimeRange
setTimeRange( String uri, DatumRange timeRange, ProgressMonitor mon ) → String
With the URI, establish if it has time series browse and set the timerange
to the given timerange if it does. For example, modify the bookmark so that the
timerange is the current axis timerange before using it.
Parameters
uri - An Autoplot URI, which must resolve to a DataSource.
timeRange - the timerange to use. If this is null or a non-timerange, then the URI is returned unchanged.
mon - the monitor
Returns:
A URI that would yield data from the same dataset but for a different time.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
showMessageDialog
showMessageDialog( java.awt.Component parent, String msg, String title, int messageType, java.lang.Exception causeBy ) → void
this will make the exception available. (Someday. TODO: where is this used?)
Parameters
parent - a Component
msg - a String
title - a String
messageType - an int
causeBy - an Exception
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
strjoin
strjoin( java.util.Collection c, String delim ) → String
Parameters
c - a java.util.Collection
delim - a String
Returns:
java.lang.String
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
strjoin( long[] dims, String delim ) → String
strjoin( int[] dims, String delim ) → String
toJavaIdentifier
toJavaIdentifier( String label ) → String
make a valid Java identifier from the label. Data sources may wish
to allow labels to be used to identify data sources, and this contains
the standard logic. Strings are replaced with underscores, invalid
chars removed, etc.
Parameters
label - a String
Returns:
valid Java identifier.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
transfer
transfer( java.nio.channels.ReadableByteChannel src, java.nio.channels.WritableByteChannel dest ) → void
transfers the data from one channel to another. src and dest are
closed after the operation is complete.
Parameters
src - a ReadableByteChannel
dest - a WritableByteChannel
Returns:
void (returns nothing)
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
transfer( java.io.InputStream src, java.io.OutputStream dest ) → void
transfer( java.io.InputStream src, java.io.OutputStream dest, boolean close ) → void
trimScatterToTimeRange
trimScatterToTimeRange( QDataSet tsbData, DatumRange timeRange ) → QDataSet
We've loaded the data, but it needs to be trimmed to exactly what the TSB requests, because a time axis
is not visible. This was introduced to support where TSB returns data that needs to be trimmed.
Parameters
tsbData - a QDataSet
timeRange - the range where the data was requested.
Returns:
the trimmed data
See Also:
https://sourceforge.net/p/autoplot/bugs/1559/
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
unescape
unescape( String s ) → String
remove escape sequences like %20 to create a human-editable string
This contains a kludge that looks for single spaces that are the result of
cut-n-pasting on Linux. If there is a space and a "%3A", then single spaces
are removed.
&
is replaced with &
.
Parameters
s - a String
Returns:
a String
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
unescapeParam
unescapeParam( String s ) → String
Carefully remove pluses from URIs that mean to interpret pluses
as spaces. Note this is not done automatically because some data sources
need the pluses, like vap+inline:ripples(20)+linspace(0.,10.,20).
This should be done carefully, because we realize that some pluses may
intentionally exist in URIs, such as &where=energy.gt(1e+3). While this
is discouraged, it will inevitably happen.
&where=energy.gt(1e+3) | &where=energy.gt(1e+3) |
&where=energy.within(1e+3+to+1e+5) | &where=energy.gt(1e+3 to 1e+5) |
Parameters
s - the parameter string, such as
Returns:
a String
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
unquote
unquote( String s ) → String
remove quotes from string, which pops up a lot in metadata
Parameters
s - the string.
Returns:
the string without quotes.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]
urlWithinContext
urlWithinContext( java.net.URL context, String url ) → String
presents the spec for the url within a context.
Parameters
context - the context.
url - the URL.
Returns:
the part made relative, if possible, to context.
[search for examples]
[view on GitHub]
[view on old javadoc]
[view source]