opendap.dap
Class Alias

java.lang.Object
  extended by opendap.dap.DAPNode
      extended by opendap.dap.Attribute
          extended by opendap.dap.Alias
All Implemented Interfaces:
Serializable, Cloneable

public class Alias
extends Attribute

The Alias type is a special attribute. It is simply a reference (like a "soft link" in a UNIX file system) to another attribute.

The rules for the definiton and interpretation an Alias are as follows:

In the persistent representation of the DDS (XML, or old DAS & DDS syntax) Alias definitions will contain 2 fields: name, attribute. Example from a DDS:

 Alias CalDate  .profiler.cast.conductivity.calibration.date
 
Or a DDX:
 <Alias name="CalDate" attribute=".profiler.cast.conductivity.calibration.date"/>
 

The rules for the interpretation of these fields are as follows:

Warning: DAS and DDS objects built using methods other than DDS.parse(), DDS.parseXML, DDS.getDAS(), or DAS.parse() must call DDS.resolveAliases() or DAS.resolveAliases() prior to allowing client software access to these objects. Since an Alias essentially represents a "pointer" to some (other) Attribute, that Attribute object must be found. Once this has been done (by calling the correct resolveAliases() method) the Aliases will act transparently as references to their target Attributes.

Version:
$Revision: 15901 $
Author:
ndp
See Also:
AttributeTable, DDS, DDS.parse(java.io.InputStream), DDS.parseXML(java.io.InputStream, boolean), DDS.getDAS(), DAS, DAS.resolveAliases(), Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class opendap.dap.DAPNode
DAPNode.CloneMap
 
Field Summary
 
Fields inherited from class opendap.dap.Attribute
ALIAS, BYTE, CONTAINER, FLOAT32, FLOAT64, INT16, INT32, STRING, UINT16, UINT32, UNKNOWN, URL
 
Fields inherited from class opendap.dap.DAPNode
_name, _nameEncoded
 
Constructor Summary
Alias(String aName, String attributeName)
          Construct an Alias.
 
Method Summary
 void appendValue(String value)
          Append a value to this attribute.
 void appendValue(String value, boolean check)
          Append a value to this attribute.
 DAPNode cloneDAG(DAPNode.CloneMap map)
          Returns a clone of this Alias.
 void deleteValueAt(int index)
          Remove the i'th String from this attribute.
 String getAliasedTo()
          Returns the name of the attribute aliased to.
 String getAliasedToAttributeField()
          Returns the name of the attribute aliased to.
 String getAliasedToAttributeFieldAsClearString()
          Returns the name of the attribute aliased to.
 AttributeTable getContainer()
          Returns the AttributeTable container.
 int getType()
          Returns the attribute type constant.
 String getValueAt(int index)
          Returns the attribute value at index.
 Enumeration getValues()
          Returns the values of this attribute as an Enumeration of String.
 boolean isAlias()
          Returns true if the attribute is an alias.
 boolean isContainer()
          Returns true if the attribute is a container.
 void print(PrintWriter os, String pad)
           
 void printXML(PrintWriter pw, String pad, boolean constrained)
           
 void setMyAttribute(Attribute a)
           
 void setMyVariable(BaseType v)
           
 
Methods inherited from class opendap.dap.Attribute
getContainerN, getNumVal, getTypeString, getTypeVal, getValueAtN, getValuesIterator, print, print, print, printXML, printXML, printXML, printXML
 
Methods inherited from class opendap.dap.DAPNode
clone, cloneDAG, getClearName, getEncodedName, getParent, isProject, setClearName, setEncodedName, setParent, setProject, setProject, setProjected
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Alias

public Alias(String aName,
             String attributeName)
Construct an Alias. This constructor is used by the DDSXMLParser to and the DAS parser build Aliases for the DDX.

Parameters:
aName - a String containing the name of the alias.
attributeName - the String containing the normalized name of the variable and attribute that this Alias references.
Method Detail

setMyAttribute

public void setMyAttribute(Attribute a)

setMyVariable

public void setMyVariable(BaseType v)

getType

public int getType()
Returns the attribute type constant.

Overrides:
getType in class Attribute
Returns:
the attribute type constant.

isContainer

public boolean isContainer()
Returns true if the attribute is a container.

Overrides:
isContainer in class Attribute
Returns:
true if the attribute is a container.

isAlias

public boolean isAlias()
Returns true if the attribute is an alias.

Overrides:
isAlias in class Attribute
Returns:
true if the attribute is an alias.

getAliasedTo

public String getAliasedTo()
Returns the name of the attribute aliased to.

Returns:
the name of the attribute aliased to.

getAliasedToAttributeFieldAsClearString

public String getAliasedToAttributeFieldAsClearString()
Returns the name of the attribute aliased to.

Returns:
the name of the attribute aliased to.

getAliasedToAttributeField

public String getAliasedToAttributeField()
Returns the name of the attribute aliased to.

Returns:
the name of the attribute aliased to.

getContainer

public AttributeTable getContainer()
                            throws NoSuchAttributeException
Returns the AttributeTable container.

Overrides:
getContainer in class Attribute
Returns:
the AttributeTable container.
Throws:
NoSuchAttributeException - If the instance of Attribute on which it is called is not a container.

getValues

public Enumeration getValues()
                      throws NoSuchAttributeException
Returns the values of this attribute as an Enumeration of String.

Overrides:
getValues in class Attribute
Returns:
an Enumeration of String.
Throws:
NoSuchAttributeException

getValueAt

public String getValueAt(int index)
                  throws NoSuchAttributeException
Returns the attribute value at index.

Overrides:
getValueAt in class Attribute
Parameters:
index - the index of the attribute value to return.
Returns:
the attribute String at index.
Throws:
NoSuchAttributeException

appendValue

public void appendValue(String value)
                 throws AttributeBadValueException
Append a value to this attribute. Always checks the validity of the attribute's value.

Overrides:
appendValue in class Attribute
Parameters:
value - the attribute String to add.
Throws:
AttributeBadValueException - thrown if the value is not a legal member of type

appendValue

public void appendValue(String value,
                        boolean check)
                 throws AttributeBadValueException
Append a value to this attribute.

Overrides:
appendValue in class Attribute
Parameters:
value - the attribute String to add.
check - if true, check the validity of he attribute's value, if false don't.
Throws:
AttributeBadValueException - thrown if the value is not a legal member of type

deleteValueAt

public void deleteValueAt(int index)
                   throws AttributeBadValueException
Remove the i'th String from this attribute.

Overrides:
deleteValueAt in class Attribute
Parameters:
index - the index of the value to remove.
Throws:
AttributeBadValueException

print

public void print(PrintWriter os,
                  String pad)
Overrides:
print in class Attribute

printXML

public void printXML(PrintWriter pw,
                     String pad,
                     boolean constrained)
Overrides:
printXML in class Attribute

cloneDAG

public DAPNode cloneDAG(DAPNode.CloneMap map)
                 throws CloneNotSupportedException
Returns a clone of this Alias. See DAPNode.cloneDag()

Overrides:
cloneDAG in class Attribute
Parameters:
map - track previously cloned nodes
Returns:
a clone of this Alias.
Throws:
CloneNotSupportedException


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.