public class DConnect2
extends java.lang.Object
implements java.io.Closeable
This class provides support for common DODS client-side operations such as dereferencing a OPeNDAP URL, communicating network activity status to the user and reading local OPeNDAP objects.
Unlike its C++ counterpart, this class does not store instances of the DAS,
DDS, etc. objects. Rather, the methods getDAS
, etc. return
instances of those objects.
Modifier and Type | Field and Description |
---|---|
protected HTTPSession |
_session |
Constructor and Description |
---|
DConnect2(java.io.InputStream stream) |
DConnect2(java.lang.String urlString)
Creates an instance bound to url which accepts compressed documents.
|
DConnect2(java.lang.String urlString,
boolean acceptCompress)
Creates an instance bound to url.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
captureDataDDS(java.io.InputStream is) |
static java.lang.String |
captureStream(java.io.InputStream is) |
java.lang.String |
CE()
Returns the constraint expression supplied with the URL given to the
constructor.
|
void |
close() |
DAS |
getDAS()
Returns the DAS object from the dataset referenced by this object's URL.
|
DataDDS |
getData(StatusUI statusUI)
Return the data object with no local constraint expression.
|
DataDDS |
getData(java.lang.String CE) |
DataDDS |
getData(java.lang.String CE,
StatusUI statusUI)
Returns the `Data object' from the dataset referenced by this object's
URL given the constraint expression CE.
|
DataDDS |
getData(java.lang.String CE,
StatusUI statusUI,
BaseTypeFactory btf)
Returns the `Data object' from the dataset referenced by this object's
URL given the constraint expression CE.
|
DataDDS |
getDataDDX()
Returns the DataDDS object from the dataset referenced by this object's URL.
|
DataDDS |
getDataDDX(java.lang.String CE)
Returns the DataDDS object from the dataset referenced by this object's URL.
|
DataDDS |
getDataDDX(java.lang.String CE,
BaseTypeFactory btf)
Returns the DataDDS object from the dataset referenced by this object's URL.
|
DDS |
getDDS()
Returns the DDS object from the dataset referenced by this object's URL.
|
DDS |
getDDS(java.lang.String CE)
Returns the DDS object from the dataset referenced by this object's URL.
|
DDS |
getDDX()
Returns the DDS object from the dataset referenced by this object's URL.
|
DDS |
getDDX(java.lang.String CE)
Returns the DDS object from the dataset referenced by this object's URL.
|
java.lang.String |
getLastExtendedHeader() |
java.lang.String |
getLastModifiedHeader() |
java.lang.String |
getLastModifiedInvalidHeader() |
ServerVersion |
getServerVersion()
Returns the
ServerVersion of the last connection. |
HTTPSession |
getSession()
Return the session associated with this connection
|
boolean |
isLocal() |
static void |
main(java.lang.String[] args) |
static void |
setAllowSessions(boolean b) |
void |
setServerVersion(int major,
int minor) |
java.lang.String |
URL()
Returns the URL supplied to the constructor.
|
protected HTTPSession _session
public DConnect2(java.lang.String urlString) throws HTTPException
urlString
- connect to this URL.java.io.FileNotFoundException
- thrown if urlString
is not
a valid URL, or a filename which exists on the system.HTTPException
public DConnect2(java.lang.String urlString, boolean acceptCompress) throws HTTPException
acceptDeflate
is true
then HTTP Request headers will indicate to servers that this client can
accept compressed documents.urlString
- Connect to this URL.acceptCompress
- true if this client will accept compressed responsesjava.io.FileNotFoundException
- thrown if urlString
is not
a valid URL, or a filename which exists on the system.HTTPException
public DConnect2(java.io.InputStream stream) throws DAP2Exception
DAP2Exception
public static void setAllowSessions(boolean b)
public void setServerVersion(int major, int minor)
public boolean isLocal()
public final java.lang.String CE()
String
.
Note that the CE supplied to one of this object's constructors is
"sticky"; it will be used with every data request made with this object.
The CE passed to getData
, however, is not sticky; it is used
only for that specific request. This method returns the sticky CE.
public final java.lang.String URL()
public HTTPSession getSession()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public static java.lang.String captureStream(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public static java.lang.String captureDataDDS(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public final ServerVersion getServerVersion()
ServerVersion
of the last connection.ServerVersion
of the last connection.public java.lang.String getLastModifiedHeader()
public java.lang.String getLastModifiedInvalidHeader()
public java.lang.String getLastExtendedHeader()
public DAS getDAS() throws java.io.IOException, DAP2Exception
java.net.MalformedURLException
- if the URL given to the
constructor has an errorjava.io.IOException
- if an error connecting to the remote serverDASException
- on an error constructing the DASDAP2Exception
- if an error returned by the remote serverpublic DDS getDDS() throws java.io.IOException, ParseException, DAP2Exception
java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if an error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if an error returned by the remote serverpublic DDS getDDS(java.lang.String CE) throws java.io.IOException, ParseException, DAP2Exception
CE
- The constraint expression to be applied to this request by the
server. This is combined with any CE given in the constructor.java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if an error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if an error returned by the remote serverpublic DDS getDDX() throws java.io.IOException, ParseException, DAP2Exception
java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if an error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if an error returned by the remote serverpublic DDS getDDX(java.lang.String CE) throws java.io.IOException, ParseException, DDSException, DAP2Exception
CE
- The constraint expression to be applied to this request by the
server. This is combined with any CE given in the constructor.java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if an error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if an error returned by the remote serverpublic DataDDS getDataDDX() throws java.net.MalformedURLException, java.io.IOException, ParseException, DDSException, DAP2Exception
java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if an error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if an error returned by the remote serverpublic DataDDS getDataDDX(java.lang.String CE) throws java.net.MalformedURLException, java.io.IOException, ParseException, DDSException, DAP2Exception
CE
- The constraint expression to use for this request.java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if an error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if an error returned by the remote serverpublic DataDDS getDataDDX(java.lang.String CE, BaseTypeFactory btf) throws java.net.MalformedURLException, java.io.IOException, ParseException, DDSException, DAP2Exception
CE
- The constraint expression to use for this request.btf
- The BaseTypeFactory
to build the member
variables in the DDS with.java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if an error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if an error returned by the remote serverBaseTypeFactory
public DataDDS getData(java.lang.String CE, StatusUI statusUI, BaseTypeFactory btf) throws java.net.MalformedURLException, java.io.IOException, ParseException, DDSException, DAP2Exception
Note that if CE is an empty String then the entire dataset will be returned, unless a "sticky" CE has been specified in the constructor.
CE
- The constraint expression to be applied to this request by the
server. This is combined with any CE given in the constructor.statusUI
- the StatusUI
object to use for GUI updates
and user cancellation notification (may be null).btf
- The BaseTypeFactory
to build the member
variables in the DDS with.DataDDS
object that results from applying the
given CE, combined with this object's sticky CE, on the referenced
dataset.java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if any error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if any error returned by the remote serverpublic DataDDS getData(java.lang.String CE) throws java.io.IOException, ParseException, DAP2Exception
java.io.IOException
ParseException
DAP2Exception
public DataDDS getData(java.lang.String CE, StatusUI statusUI) throws java.net.MalformedURLException, java.io.IOException, ParseException, DDSException, DAP2Exception
Note that if CE is an empty String then the entire dataset will be returned, unless a "sticky" CE has been specified in the constructor.
CE
- The constraint expression to be applied to this request by the
server. This is combined with any CE given in the constructor.statusUI
- the StatusUI
object to use for GUI updates
and user cancellation notification (may be null).DataDDS
object that results from applying the
given CE, combined with this object's sticky CE, on the referenced
dataset.java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if any error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if any error returned by the remote serverpublic final DataDDS getData(StatusUI statusUI) throws java.net.MalformedURLException, java.io.IOException, ParseException, DDSException, DAP2Exception
getData("", statusUI)
.statusUI
- the StatusUI
object to use for GUI updates
and user cancellation notification (may be null).DataDDS
object that results from applying
this object's sticky CE, if any, on the referenced dataset.java.net.MalformedURLException
- if the URL given to the constructor
has an errorjava.io.IOException
- if any error connecting to the remote serverParseException
- if the DDS parser returned an errorDDSException
- on an error constructing the DDSDAP2Exception
- if any error returned by the remote serverpublic static void main(java.lang.String[] args)
args
- command line arguments