Package opendap.servers
Interface ServerMethods
- All Known Subinterfaces:
ServerArrayMethods
- All Known Implementing Classes:
SDArray,SDByte,SDFloat32,SDFloat64,SDGrid,SDInt16,SDInt32,SDList,SDSequence,SDString,SDStructure,SDUInt16,SDUInt32,SDURL
public interface ServerMethods
This interface defines the additional behaviors that Server side types
need to support. These include:
The file I/O operations of which each variable must be capable.
The projection information. A projection defines the variables specified by a constraint to be returned by the server. These methods store projection information for a non-vector variable. Each variable type used on the server-side of OPeNDAP must implement this interface or one of its descendents.
The methods that define how each type responds to relational operators. Most (all?) types will not have sensible responses to all of the relational operators (e.g. SDByte won't know how to match a regular expression but SDString will). For those operators that are nonsensical a class should throw InvalidOperator.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanequal(opendap.dap.BaseType bt) TheOperatorclass contains a generalized implementation of this method.booleangreater(opendap.dap.BaseType bt) TheOperatorclass contains a generalized implementation of this method.booleangreater_eql(opendap.dap.BaseType bt) TheOperatorclass contains a generalized implementation of this method.booleanCheck the projection state of this variable.booleanisRead()Get the value of the Read property.booleanGet the value of the Synthesized property.booleanless(opendap.dap.BaseType bt) TheOperatorclass contains a generalized implementation of this method.booleanless_eql(opendap.dap.BaseType bt) TheOperatorclass contains a generalized implementation of this method.booleannot_equal(opendap.dap.BaseType bt) TheOperatorclass contains a generalized implementation of this method.booleanRead a value from the named dataset for this variable.booleanregexp(opendap.dap.BaseType bt) TheOperatorclass contains a generalized implementation of this method.voidserialize(String dataset, DataOutputStream sink, CEEvaluator ce, Object specialO) Server-side serialization for OPeNDAP variables (sub-classes ofBaseType).voidsetProject(boolean state) Set the Project property of this variable.voidsetProject(boolean state, boolean all) Set the state of this variable's projection.voidsetRead(boolean state) Set the Read property.voidsetSynthesized(boolean state) Set the Synthesized property.
-
Method Details
-
setSynthesized
void setSynthesized(boolean state) Set the Synthesized property.- Parameters:
state- Iftruethen the variable is considered a synthetic variable and no part of OPeNDAP will ever try to read it from a file, otherwise iffalsethe variable is considered a normal variable whose value should be read using theread()method. By default this property is false.- See Also:
-
isSynthesized
boolean isSynthesized()Get the value of the Synthesized property.- Returns:
trueif this is a synthetic variable,falseotherwise.
-
setRead
void setRead(boolean state) Set the Read property. A normal variable is read using theread()method. Once read the Read property istrue. Use this function to manually set the property value. By default this property is false.- Parameters:
state-trueif the variable has been read,falseotherwise.- See Also:
-
isRead
boolean isRead()Get the value of the Read property.- Returns:
trueif the variable has been read,falseotherwise.- See Also:
-
read
boolean read(String datasetName, Object specialO) throws opendap.dap.NoSuchVariableException, IOException Read a value from the named dataset for this variable.- Parameters:
datasetName- String identifying the file or other data store from which to read a vaue for this variable.specialO- ThisObjectis a goody that is used by a Server implementations to deliver important, and as yet unknown, stuff to the read method. If you don't need it, make it anull.- Returns:
trueif more data remains to be read, otehrwisefalse.- Throws:
opendap.dap.NoSuchVariableException- When a variable can't be found.IOException- When there is a problem reading data.
-
setProject
void setProject(boolean state, boolean all) Set the state of this variable's projection.truemeans that this variable is part of the current projection as defined by the current constraint expression, otherwise the current projection for this variable should befalse.
For simple variables and for children of DVector, the variable either is or is not projected. For children of DConstructor, it may be that the request is for only part of the constructor type (e.g., only oe field of a structure). However, the structure variable itself must be marked as projected given the implementation of serialize. The serialize() method does not search the entire tree of variables; it relies on the fact that for a particular variable to be sent, the path from the top of the DDS to that variable must be marked as `projected', not just the variable itself. This keeps the CEEvaluator.send() method from having to search the entire tree for the variables to be sent.- Parameters:
state-trueif the variable is part of the current projection,falseotherwise.all- set (or clear) the Project property of any children.- See Also:
-
setProject
void setProject(boolean state) Set the Project property of this variable. This is equivalent to calling setProject(, true). - Parameters:
state-trueif the variable is part of the current projection,falseotherwise.- See Also:
-
isProject
boolean isProject()Check the projection state of this variable. Is the this variable marked as projected? If the variable is listed in the projection part of a constraint expression, then the CE parser should mark it as projected. When this method is called on such a variable it should returntrue, otherwise it should returnfalse.- Returns:
trueif the variable is part of the current projections,falseotherwise.- See Also:
-
equal
boolean equal(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException TheOperatorclass contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.- Parameters:
bt- The variable to which to compare 'this' value.- Returns:
- True when they are equal, false otherwise.
- Throws:
InvalidOperatorException- When the operator cannot be applied to the two data types.RegExpException- When the regular expression is badly formed.SBHException- When Something Bad Happens.- See Also:
-
not_equal
boolean not_equal(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException TheOperatorclass contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.- Parameters:
bt- The variable to which to compare 'this' value.- Returns:
- True when they are not equal, false otherwise.
- Throws:
InvalidOperatorException- When the operator cannot be applied to the two data types.RegExpException- When the regular expression is badly formed.SBHException- When Something Bad Happens.- See Also:
-
greater
boolean greater(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException TheOperatorclass contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.- Parameters:
bt- The variable to which to compare 'this' value.- Returns:
- True when this value is greater than the based 'bt' value, false otherwise.
- Throws:
InvalidOperatorException- When the operator cannot be applied to the two data types.RegExpException- When the regular expression is badly formed.SBHException- When Something Bad Happens.- See Also:
-
greater_eql
boolean greater_eql(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException TheOperatorclass contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.- Parameters:
bt- The variable to which to compare 'this' value.- Returns:
- True when this value is greater or equal than the based 'bt' value, false otherwise.
- Throws:
InvalidOperatorException- When the operator cannot be applied to the two data types.RegExpException- When the regular expression is badly formed.SBHException- When Something Bad Happens.- See Also:
-
less
boolean less(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException TheOperatorclass contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.- Parameters:
bt- The variable to which to compare 'this' value.- Returns:
- True when this value is less than the based 'bt' value, false otherwise.
- Throws:
InvalidOperatorException- When the operator cannot be applied to the two data types.RegExpException- When the regular expression is badly formed.SBHException- When Something Bad Happens.- See Also:
-
less_eql
boolean less_eql(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException TheOperatorclass contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.- Parameters:
bt- The variable to which to compare 'this' value.- Returns:
- True when this value is less than or equal to the based 'bt' value, false otherwise.
- Throws:
InvalidOperatorException- When the operator cannot be applied to the two data types.RegExpException- When the regular expression is badly formed.SBHException- When Something Bad Happens.- See Also:
-
regexp
boolean regexp(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException TheOperatorclass contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.- Parameters:
bt- The variable to which to compare 'this' value.- Returns:
- True when regular expression evaluates to true., false otherwise.
- Throws:
InvalidOperatorException- When the operator cannot be applied to the two data types.RegExpException- When the regular expression is badly formed.SBHException- When Something Bad Happens.- See Also:
-
serialize
void serialize(String dataset, DataOutputStream sink, CEEvaluator ce, Object specialO) throws opendap.dap.NoSuchVariableException, DAP2ServerSideException, IOException Server-side serialization for OPeNDAP variables (sub-classes ofBaseType). This does not send the entire class as the JavaSerializableinterface does, rather it sends only the binary data values. Other software is responsible for sending variable type information (seeDDS).
Writes data to aDataOutputStream. This method is used on the server side of the OPeNDAP client/server connection, and possibly by GUI clients which need to download OPeNDAP data, manipulate it, and then re-save it as a binary file.
For children of DConstructor, this method should call itself on each of the components. For other types this method should call externalize().- Parameters:
dataset- aStringindicated which dataset to read from (Or something else if you so desire).sink- aDataOutputStreamto write to.ce- theCEEvaluatorto use in the parse process.specialO- ThisObjectis a goody that is used by a Server implementations to deliver important, and as yet unknown, stuff to the read method. If you don't need it, make it anull.- Throws:
IOException- thrown on anyOutputStreamexception.opendap.dap.NoSuchVariableException- When a variable cannot be found.DAP2ServerSideException- When there is a server error.- See Also:
-
BaseTypeDDSServerDDS
-