Class SDList

java.lang.Object
opendap.dap.DAPNode
opendap.dap.BaseType
opendap.dap.DVector
opendap.dap.DList
opendap.servers.SDList
All Implemented Interfaces:
Serializable, Cloneable, opendap.dap.ClientIO, RelOps, ServerMethods

public abstract class SDList extends opendap.dap.DList implements ServerMethods, RelOps
Holds a OPeNDAP Server List value.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class opendap.dap.DAPNode

    opendap.dap.DAPNode.CloneMap
  • Field Summary

    Fields inherited from class opendap.dap.DAPNode

    _nameClear, _nameEncoded, log
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new SDList.
    Constructs a new SDList with name n.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equal(opendap.dap.BaseType bt)
    The RelOps interface defines how each type responds to relational operators.
    boolean
    greater(opendap.dap.BaseType bt)
    The Operator class contains a generalized implementation of this method.
    boolean
    greater_eql(opendap.dap.BaseType bt)
    The Operator class contains a generalized implementation of this method.
    boolean
    Get the value of the Read property.
    boolean
    Get the value of the Synthesized property.
    boolean
    less(opendap.dap.BaseType bt)
    The Operator class contains a generalized implementation of this method.
    boolean
    less_eql(opendap.dap.BaseType bt)
    The Operator class contains a generalized implementation of this method.
    boolean
    not_equal(opendap.dap.BaseType bt)
    The Operator class contains a generalized implementation of this method.
    void
    printDecl(PrintWriter os, String space, boolean print_semi, boolean constrained)
    Write the variable's declaration in a C-style syntax.
    void
    printVal(PrintWriter os, String space, boolean print_decl_p)
    Prints the value of the variable, with its declaration.
    abstract boolean
    read(String datasetName, Object specialO)
    Read a value from the named dataset for this variable.
    boolean
    regexp(opendap.dap.BaseType bt)
    The Operator class contains a generalized implementation of this method.
    void
    serialize(String dataset, DataOutputStream sink, CEEvaluator ce, Object specialO)
    Server-side serialization for OPeNDAP variables (sub-classes of BaseType).
    void
    setProject(boolean state, boolean all)
    Set the state of this variable's projection.
    void
    setRead(boolean state)
    Set the Read property.
    void
    setSynthesized(boolean state)
    Set the Synthesized property.

    Methods inherited from class opendap.dap.DList

    getTypeName

    Methods inherited from class opendap.dap.DVector

    addVariable, cloneDAG, deserialize, externalize, getContainerVar, getLength, getPrimitiveVector, setContainerVar, setLength

    Methods inherited from class opendap.dap.BaseType

    addAttributeAlias, addAttributeContainer, appendAttribute, appendAttribute, appendAttributeContainer, checkSemantics, checkSemantics, delAttribute, delAttribute, elementCount, elementCount, getAttribute, getAttribute, getAttributeNames, getAttributeTable, getLongName, hasAttributes, newPrimitiveVector, printAttributes, printAttributes, printAttributes, printAttributes, printConstraint, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printVal, printVal, printVal, printXML, printXML, printXML, printXML, printXML, setClearName

    Methods inherited from class opendap.dap.DAPNode

    clone, cloneDAG, getClearName, getEncodedName, getParent, isProject, setEncodedName, setParent, setProject, setProjected

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface opendap.servers.ServerMethods

    isProject, setProject
  • Constructor Details

    • SDList

      public SDList()
      Constructs a new SDList.
    • SDList

      public SDList(String n)
      Constructs a new SDList with name n.
      Parameters:
      n - the name of the variable.
  • Method Details

    • printDecl

      public void printDecl(PrintWriter os, String space, boolean print_semi, boolean constrained)
      Write the variable's declaration in a C-style syntax. This function is used to create textual representation of the Data Descriptor Structure (DDS). See The OPeNDAP User Manual for information about this structure.
      Overrides:
      printDecl in class opendap.dap.DVector
      Parameters:
      os - The PrintWriter on which to print the declaration.
      space - Each line of the declaration will begin with the characters in this string. Usually used for leading spaces.
      print_semi - a boolean value indicating whether to print a semicolon at the end of the declaration.
      constrained - a boolean value indicating whether to print the declartion dependent on the projection information. This is only used by Server side code.
      See Also:
      • BaseType.printDecl(PrintWriter, String, boolean, boolean)
    • printVal

      public void printVal(PrintWriter os, String space, boolean print_decl_p)
      Prints the value of the variable, with its declaration. This function is primarily intended for debugging OPeNDAP applications and text-based clients such as geturl.

      Important Note

      This method overrides the BaseType method of the same name and type signature and it significantly changes the behavior for all versions of printVal() for this type: All the various versions of printVal() will only print a value, or a value with declaration, if the variable is in the projection.

      In other words, if a call to isProject() for a particular variable returns true then printVal() will print a value (or a declaration and a value).

      If isProject() for a particular variable returns false then printVal() is basically a No-Op.

      Overrides:
      printVal in class opendap.dap.DVector
      Parameters:
      os - the PrintWriter on which to print the value.
      space - this value is passed to the printDecl method, and controls the leading spaces of the output.
      print_decl_p - a boolean value controlling whether the variable declaration is printed as well as the value.
      See Also:
    • setProject

      public void setProject(boolean state, boolean all)
      Set the state of this variable's projection. true means that this variable is part of the current projection as defined by the current constraint expression, otherwise the current projection for this variable should be false.
      Specified by:
      setProject in interface ServerMethods
      Overrides:
      setProject in class opendap.dap.DAPNode
      Parameters:
      state - true if the variable is part of the current projection, false otherwise.
      all - This parameter has no effect for this type of variable.
      See Also:
    • equal

      public boolean equal(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException
      The RelOps interface defines how each type responds to relational operators. Most (all?) types will not have sensible responses to all of the relational operators (e.g. DList won't know how to match a regular expression but DString will). For those operators that are nonsensical a class should throw InvalidOperatorException.
      Specified by:
      equal in interface RelOps
      Specified by:
      equal in interface ServerMethods
      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

      public boolean not_equal(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException
      Description copied from interface: ServerMethods
      The Operator class contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.
      Specified by:
      not_equal in interface RelOps
      Specified by:
      not_equal in interface ServerMethods
      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

      public boolean greater(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException
      Description copied from interface: ServerMethods
      The Operator class contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.
      Specified by:
      greater in interface RelOps
      Specified by:
      greater in interface ServerMethods
      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

      public boolean greater_eql(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException
      Description copied from interface: ServerMethods
      The Operator class contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.
      Specified by:
      greater_eql in interface RelOps
      Specified by:
      greater_eql in interface ServerMethods
      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

      public boolean less(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException
      Description copied from interface: ServerMethods
      The Operator class contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.
      Specified by:
      less in interface RelOps
      Specified by:
      less in interface ServerMethods
      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

      public boolean less_eql(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException
      Description copied from interface: ServerMethods
      The Operator class contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.
      Specified by:
      less_eql in interface RelOps
      Specified by:
      less_eql in interface ServerMethods
      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

      public boolean regexp(opendap.dap.BaseType bt) throws InvalidOperatorException, RegExpException, SBHException
      Description copied from interface: ServerMethods
      The Operator class contains a generalized implementation of this method. It should be used unless a localized architecture/implementation requires otherwise.
      Specified by:
      regexp in interface RelOps
      Specified by:
      regexp in interface ServerMethods
      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:
    • setSynthesized

      public void setSynthesized(boolean state)
      Set the Synthesized property.
      Specified by:
      setSynthesized in interface ServerMethods
      Parameters:
      state - If true then the variable is considered a synthetic variable and no part of OPeNDAP will ever try to read it from a file, otherwise if false the variable is considered a normal variable whose value should be read using the read() method. By default this property is false.
      See Also:
    • isSynthesized

      public boolean isSynthesized()
      Get the value of the Synthesized property.
      Specified by:
      isSynthesized in interface ServerMethods
      Returns:
      true if this is a synthetic variable, false otherwise.
    • setRead

      public void setRead(boolean state)
      Set the Read property. A normal variable is read using the read() method. Once read the Read property is true. Use this function to manually set the property value. By default this property is false.
      Specified by:
      setRead in interface ServerMethods
      Parameters:
      state - true if the variable has been read, false otherwise.
      See Also:
    • isRead

      public boolean isRead()
      Get the value of the Read property.
      Specified by:
      isRead in interface ServerMethods
      Returns:
      true if the variable has been read, false otherwise.
      See Also:
    • read

      public abstract boolean read(String datasetName, Object specialO) throws opendap.dap.NoSuchVariableException, IOException, EOFException
      Read a value from the named dataset for this variable.

      Caution:

      When reading Lists of sequences (children of DSequence) it is crucial that it be handled with great care. Sequences have been implemented so that only one instance (or row if you will) is retained in memory at a given time. In order to correctly read a List of Sequences the read() method for the List must create an instance of the Sequence for each member of the List, typically by repeatedly cloning the template variable in the PrimitiveVector. The important next step is: DO NOT attempt to read any data into the sequences from within the read() method of the List. The sequence's data will get read, and constraint expressions applied when the serialze() method of the List calls the serialize() method of the Sequence, which in turn calls the read method of the Sequence. Good Luck!
      Specified by:
      read in interface ServerMethods
      Parameters:
      datasetName - String identifying the file or other data store from which to read a vaue for this variable.
      specialO - This Object is a goody that is used by Server implementations to deliver important, and as yet unknown, stuff to the read method. If you don't need it, make it a null.
      Returns:
      true if more data remains to be read, otherwise false. This is an abtsract method that must be implemented as part of the installation/localization of a OPeNDAP server.
      Throws:
      IOException
      EOFException
      opendap.dap.NoSuchVariableException - When a variable can't be found.
    • serialize

      public void serialize(String dataset, DataOutputStream sink, CEEvaluator ce, Object specialO) throws opendap.dap.NoSuchVariableException, DAP2ServerSideException, IOException

      Server-side serialization for OPeNDAP variables (sub-classes of BaseType). This does not send the entire class as the Java Serializable interface does, rather it sends only the binary data values. Other software is responsible for sending variable type information (see DDS).

      Writes data to a DataOutputStream. 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.

      Caution:

      When serializing lists of sequences (children of DSequence) it is crucial that it be handled with great care. Sequences have been implemented so that only one instance (or row if you will) is retained in memory at a given time. In order to correctly serialize a list of sequences the read() method for the List must create an instance of the sequence for each member of the list, typically by repeatedly cloning the template variable in the PrimitiveVector. The important next step is to NOT attempt to read any data into the sequences from within the read() method of the List. The sequence's data will get read, and constraint expressions applied when the serialze() method of the List calls the serialize() method of the sequence. Good Luck!
      Specified by:
      serialize in interface ServerMethods
      Parameters:
      sink - a DataOutputStream to write to.
      dataset - a String indicated which dataset to read from (Or something else if you so desire).
      ce - the CEEvaluator to use in the parse process.
      specialO - This Object is 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 a null.
      Throws:
      IOException - thrown on any OutputStream exception.
      opendap.dap.NoSuchVariableException - When a variable cannot be found.
      DAP2ServerSideException - When there is a server error.
      See Also: